]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
main: fix mode changing before splash is shown
authorLaurent Bigonville <bigon@bigon.be>
Tue, 7 Apr 2020 13:22:02 +0000 (09:22 -0400)
committerRay Strode <rstrode@redhat.com>
Tue, 7 Apr 2020 13:22:02 +0000 (09:22 -0400)
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.

src/main.c

index f2232175126a1da6eea8f5f4ad6622428901beb8..f0377848169f8ff8d66c0759776dc72b5bf70ca1 100644 (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;