xorg-x11-server/xorg-x11-server-1.1.1-vt-activate-is-a-terrible-api.patch
Adam Jackson 72b72a257a * Mon Dec 18 2006 Adam Jackson <ajax@redhat.com> 1.1.1-56
- RHEL5 sync:
  - xorg-x11-server-1.1.1-maxpixclock-option.patch: Allow the maximum pixel
    clock of a monitor to be specified in the config file.
  - xorg-x11-server-1.1.1-glcore-visual-matching.patch: Fix a client crash
    when creating software indirect GLX contexts.
  - xorg-x11-server-1.1.1-vt-activate-is-a-terrible-api.patch: During server
    init, abort if either VT activation ioctl fails.  During shutdown, be
    sure to wait for the VT switch to finish before exiting.
2006-12-18 21:18:01 +00:00

38 lines
1.5 KiB
Diff

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