summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2012-01-31 16:25:20 +1100
committerRobert Ancell <robert.ancell@canonical.com>2012-01-31 16:25:20 +1100
commit9f6381ff99c2506716637e0ac3036d2bb06504e7 (patch)
tree37524efd3d0c8db449f8b0aa880d459bcec92bf8 /src
parent8393e6c0cd4fe59c938af816f5ee34b6e47a576a (diff)
downloadlightdm-9f6381ff99c2506716637e0ac3036d2bb06504e7.tar.gz
Wait for the VT to become active when switching to avoid a suspected race condition somewhere between LightDM, X, ConsoleKit and the kernel
Diffstat (limited to 'src')
-rw-r--r--src/vt.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/vt.c b/src/vt.c
index 62839d9d..a0fe2091 100644
--- a/src/vt.c
+++ b/src/vt.c
@@ -80,8 +80,16 @@ vt_set_active (gint number)
if (console_fd >= 0)
{
int n = number;
+
if (ioctl (console_fd, VT_ACTIVATE, n) < 0)
g_warning ("Error using VT_ACTIVATE %d on /dev/console: %s", n, strerror (errno));
+
+ /* 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 (console_fd, VT_WAITACTIVE) < 0)
+ g_warning ("Error using VT_WAITACTIVE %d on /dev/console: %s", n, strerror (errno));
+
close (console_fd);
}
#endif