summaryrefslogtreecommitdiff
path: root/hw/xfree86
diff options
context:
space:
mode:
Diffstat (limited to 'hw/xfree86')
-rw-r--r--hw/xfree86/os-support/linux/lnx_init.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c
index 94853070d..4acaf33d1 100644
--- a/hw/xfree86/os-support/linux/lnx_init.c
+++ b/hw/xfree86/os-support/linux/lnx_init.c
@@ -62,18 +62,24 @@ drain_console(int fd, void *closure)
}
}
-static void
+static int
switch_to(int vt, const char *from)
{
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) {
+ xf86Msg(X_WARNING, "%s: VT_ACTIVATE failed: %s\n", from, strerror(errno));
+ return 0;
+ }
SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_WAITACTIVE, vt));
- if (ret < 0)
- FatalError("%s: VT_WAITACTIVE failed: %s\n", from, strerror(errno));
+ if (ret < 0) {
+ xf86Msg(X_WARNING, "%s: VT_WAITACTIVE failed: %s\n", from, strerror(errno));
+ return 0;
+ }
+
+ return 1;
}
#pragma GCC diagnostic push
@@ -208,7 +214,8 @@ xf86OpenConsole(void)
/*
* now get the VT. This _must_ succeed, or else fail completely.
*/
- switch_to(xf86Info.vtno, "xf86OpenConsole");
+ if (!switch_to(xf86Info.vtno, "xf86OpenConsole"))
+ FatalError("xf86OpenConsole: Switching VT failed\n");
SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_GETMODE, &VT));
if (ret < 0)
@@ -269,7 +276,8 @@ xf86OpenConsole(void)
else { /* serverGeneration != 1 */
if (!xf86Info.ShareVTs && xf86Info.autoVTSwitch) {
/* now get the VT */
- switch_to(xf86Info.vtno, "xf86OpenConsole");
+ if (!switch_to(xf86Info.vtno, "xf86OpenConsole"))
+ FatalError("xf86OpenConsole: Switching VT failed\n");
}
}
}