]> rtime.felk.cvut.cz Git - sojka/lightdm.git/commitdiff
Update vt ioctl usage
authorMichael Terry <michael.terry@canonical.com>
Thu, 20 Oct 2016 08:53:37 +0000 (10:53 +0200)
committerMichael Terry <michael.terry@canonical.com>
Thu, 20 Oct 2016 08:53:37 +0000 (10:53 +0200)
src/vt.c

index 8d31f78b25ece779c2901670b58051c9ceb6342a..d784a8c83174d4bd894e378f94f4fc279a45dc26 100644 (file)
--- a/src/vt.c
+++ b/src/vt.c
@@ -92,12 +92,16 @@ vt_set_active (gint number)
         int n = number;
 
         if (ioctl (tty_fd, VT_ACTIVATE, n) < 0)
+        {
             g_warning ("Error using VT_ACTIVATE %d on /dev/tty0: %s", n, strerror (errno));
+            close (tty_fd);
+            return;
+        }
 
         /* Wait for the VT to become active to avoid a suspected
          * race condition somewhere between LightDM, X, ConsoleKit and the kernel.
          * See https://bugs.launchpad.net/bugs/851612 */
-        if (ioctl (tty_fd, VT_WAITACTIVE) < 0)
+        if (ioctl (tty_fd, VT_WAITACTIVE, n) < 0)
             g_warning ("Error using VT_WAITACTIVE %d on /dev/tty0: %s", n, strerror (errno));
 
         close (tty_fd);