main: fix mode changing before splash is shown

At the moment switching modes affects two aspects of how plymouth
runs.

1) What log file is opened (i.e., boot.log or no log file at all)
2) What type of splash gets shown (the details of which are relegated
   to the individual splash plugins)

The mode change handler has a check in place to avoid changing the
type of splash getting shown in the event no splash is supposed to
be shown yet.  This check just makes the function return without
doing anything.

Unfortunately, the check is placed at the top of the function, so
it runs before the log file is changed.

This commit moves the check lower down, so the log file gets properly
updated when the mode is changed.
This commit is contained in:
Laurent Bigonville 2020-04-07 09:22:02 -04:00 committed by Ray Strode
parent 5cb1ad3af5
commit 702fd05feb

View file

@ -192,11 +192,6 @@ static void
on_change_mode (state_t *state,
const char *mode)
{
if (state->boot_splash == NULL) {
ply_trace ("no splash set");
return;
}
ply_trace ("updating mode to '%s'", mode);
if (strcmp (mode, "boot-up") == 0)
state->mode = PLY_BOOT_SPLASH_MODE_BOOT_UP;
@ -217,6 +212,11 @@ on_change_mode (state_t *state,
prepare_logging (state);
}
if (state->boot_splash == NULL) {
ply_trace ("no splash set");
return;
}
if (!ply_boot_splash_show (state->boot_splash, state->mode)) {
ply_trace ("failed to update splash");
return;