aboutsummaryrefslogtreecommitdiffstats
path: root/xorg-server-hwcursor-gamma/0001-linux-Do-not-call-FatalError-from-xf86CloseConsole.patch
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server-hwcursor-gamma/0001-linux-Do-not-call-FatalError-from-xf86CloseConsole.patch')
-rw-r--r--xorg-server-hwcursor-gamma/0001-linux-Do-not-call-FatalError-from-xf86CloseConsole.patch84
1 files changed, 84 insertions, 0 deletions
diff --git a/xorg-server-hwcursor-gamma/0001-linux-Do-not-call-FatalError-from-xf86CloseConsole.patch b/xorg-server-hwcursor-gamma/0001-linux-Do-not-call-FatalError-from-xf86CloseConsole.patch
new file mode 100644
index 0000000..a33840a
--- /dev/null
+++ b/xorg-server-hwcursor-gamma/0001-linux-Do-not-call-FatalError-from-xf86CloseConsole.patch
@@ -0,0 +1,84 @@
+From ca355e9d6acab994453cdbb65cb213d09ee4a50f Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede@redhat.com>
+Date: Wed, 14 Oct 2015 15:10:35 +0200
+Subject: [PATCH] linux: Do not call FatalError from xf86CloseConsole
+
+FatalError ends up calling xf86CloseConsole itself, so calling FatalError
+from within xf86CloseConsole is not a good idea.
+
+All the other error checking done in xf86CloseConsole uses
+xf86Msg(X_WARNING, ...) except for the switch_to() helper function,
+change things so that switch_to() also uses xf86Msg rather then FatalError
+when called from xf86CloseConsole.
+
+BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1269210
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+---
+ hw/xfree86/os-support/linux/lnx_init.c | 24 ++++++++++++++++--------
+ 1 file changed, 16 insertions(+), 8 deletions(-)
+
+diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c
+index ec06a05..9fec964 100644
+--- a/hw/xfree86/os-support/linux/lnx_init.c
++++ b/hw/xfree86/os-support/linux/lnx_init.c
+@@ -64,17 +64,25 @@ drain_console(int fd, void *closure)
+ }
+
+ static void
+-switch_to(int vt, const char *from)
++switch_to(int vt, Bool is_open)
+ {
+ int ret;
+
+ SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_ACTIVATE, vt));
+- if (ret < 0)
+- FatalError("%s: VT_ACTIVATE failed: %s\n", from, strerror(errno));
++ if (ret < 0) {
++ if (is_open)
++ FatalError("xf86OpenConsole: VT_ACTIVATE failed: %s\n", strerror(errno));
++ else
++ xf86Msg(X_WARNING, "xf86CloseConsole: VT_ACTIVATE failed: %s\n", strerror(errno));
++ }
+
+ SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_WAITACTIVE, vt));
+- if (ret < 0)
+- FatalError("%s: VT_WAITACTIVE failed: %s\n", from, strerror(errno));
++ if (ret < 0) {
++ if (is_open)
++ FatalError("xf86OpenConsole: VT_WAITACTIVE failed: %s\n", strerror(errno));
++ else
++ xf86Msg(X_WARNING, "xf86CloseConsole: VT_WAITACTIVE failed: %s\n", strerror(errno));
++ }
+ }
+
+ #pragma GCC diagnostic push
+@@ -233,7 +241,7 @@ xf86OpenConsole(void)
+ /*
+ * now get the VT. This _must_ succeed, or else fail completely.
+ */
+- switch_to(xf86Info.vtno, "xf86OpenConsole");
++ switch_to(xf86Info.vtno, TRUE);
+
+ SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_GETMODE, &VT));
+ if (ret < 0)
+@@ -294,7 +302,7 @@ xf86OpenConsole(void)
+ else { /* serverGeneration != 1 */
+ if (!xf86Info.ShareVTs && xf86Info.autoVTSwitch) {
+ /* now get the VT */
+- switch_to(xf86Info.vtno, "xf86OpenConsole");
++ switch_to(xf86Info.vtno, TRUE);
+ }
+ }
+ }
+@@ -346,7 +354,7 @@ xf86CloseConsole(void)
+ * Perform a switch back to the active VT when we were started
+ */
+ if (activeVT >= 0) {
+- switch_to(activeVT, "xf86CloseConsole");
++ switch_to(activeVT, FALSE);
+ activeVT = -1;
+ }
+ }
+--
+2.5.0
+