]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
[terminal] wait for vt switching to finish on quit
authorRay Strode <rstrode@redhat.com>
Thu, 29 Apr 2010 17:23:18 +0000 (13:23 -0400)
committerRay Strode <rstrode@redhat.com>
Thu, 29 Apr 2010 17:23:18 +0000 (13:23 -0400)
After changing the active vt during start up,
we get a signal when it finishes, because we're in
VT_PROCESS mode, so we don't need to explicitly block
waiting for it to finish.

During the quit path, though, we aren't in VT_PROCESS mode anymore,
won't get any signals, and still need to know that the VT switch
is finished before informing the client that the quit is
finished.

This commit forces ply_terminal_deactivate_vt to block until the
VT switch it initiates finishes.

src/libply-splash-core/ply-terminal.c

index 92e4a442a19351cb74dacccb8f7dd62c4e2965a0..f71f25af51247a298eb3a5c767c585ed09f6fabd 100644 (file)
@@ -742,6 +742,16 @@ set_active_vt (ply_terminal_t *terminal,
   return true;
 }
 
+static bool
+wait_for_vt_to_become_active (ply_terminal_t *terminal,
+                              int             vt_number)
+{
+  if (ioctl (terminal->fd, VT_WAITACTIVE, vt_number) < 0)
+    return false;
+
+  return true;
+}
+
 static bool
 deallocate_vt (ply_terminal_t *terminal,
                int             vt_number)
@@ -752,7 +762,6 @@ deallocate_vt (ply_terminal_t *terminal,
   return true;
 }
 
-
 bool
 ply_terminal_activate_vt (ply_terminal_t *terminal)
 {
@@ -815,6 +824,13 @@ ply_terminal_deactivate_vt (ply_terminal_t *terminal)
           ply_trace ("Couldn't move console to initial vt: %m");
           return false;
         }
+
+      if (!wait_for_vt_to_become_active (terminal, terminal->initial_vt_number))
+        {
+          ply_trace ("Error while waiting for vt %d to become active: %m",
+                     terminal->initial_vt_number);
+          return false;
+        }
     }
   else
     {