01f5fa1
--- xorg-server-1.1.1/hw/xfree86/os-support/linux/lnx_init.c.vt-activate	2006-07-05 14:31:41.000000000 -0400
72b72a2
+++ xorg-server-1.1.1/hw/xfree86/os-support/linux/lnx_init.c	2006-12-14 22:00:25.000000000 -0500
01f5fa1
@@ -248,14 +248,20 @@
eb5ef29
 #endif
eb5ef29
 	    /*
eb5ef29
 	     * now get the VT
eb5ef29
+	     *
eb5ef29
+	     * There's a race here, in that if someone else does a VT_ACTIVATE
eb5ef29
+	     * between our ACTIVATE/WAITACTIVE, we might never get the VT.
01f5fa1
+	     * So we have to fail in that case.  There's really no fixing this,
eb5ef29
+	     * it's a racy protocol.
eb5ef29
 	     */
01f5fa1
 	    if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) < 0)
eb5ef29
-	        xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed: %s\n",
eb5ef29
-		        strerror(errno));
01f5fa1
+		FatalError("xf86OpenConsole: VT_ACTIVATE failed: %s\n",
01f5fa1
+			   strerror(errno));
01f5fa1
+
eb5ef29
 
01f5fa1
 	    if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) < 0)
eb5ef29
-	        xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed: %s\n",
eb5ef29
-		    strerror(errno));
01f5fa1
+		FatalError("xf86OpenConsole: VT_WAITACTIVE failed: %s\n",
01f5fa1
+			   strerror(errno));
eb5ef29
 
eb5ef29
 	    if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0)
eb5ef29
 	        FatalError("xf86OpenConsole: VT_GETMODE failed %s\n",
72b72a2
@@ -352,6 +358,9 @@
72b72a2
 	    if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, activeVT) < 0)
72b72a2
 	        xf86Msg(X_WARNING, "xf86CloseConsole: VT_ACTIVATE failed: %s\n",
72b72a2
 		        strerror(errno));
72b72a2
+	    if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, activeVT) < 0)
72b72a2
+	        xf86Msg(X_WARNING, "xf86CloseConsole: VT_WAITACTIVE failed: %s\n",
72b72a2
+		        strerror(errno));
72b72a2
 	    activeVT = -1;
72b72a2
         }
72b72a2