[PATCH] xfree86: don't restore the TTY mode if we didn't initialize it ourselves

Peter Hutterer peter.hutterer at who-t.net
Wed Dec 17 15:01:27 PST 2008


Restoring it unconditionally means we restore to whatever tty_mode has as
default value (i.e. 0). K_RAW happens to be 0x00, so we always restore to raw
mode if allowEmptyInput is off.
---
 hw/xfree86/os-support/linux/lnx_init.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c
index da5ca57..6ee8ed6 100644
--- a/hw/xfree86/os-support/linux/lnx_init.c
+++ b/hw/xfree86/os-support/linux/lnx_init.c
@@ -376,8 +376,10 @@ xf86CloseConsole()
 	xf86Msg(X_WARNING, "xf86CloseConsole: KDSETMODE failed: %s\n",
 		strerror(errno));
 
-    ioctl(xf86Info.consoleFd, KDSKBMODE, tty_mode);
-    tcsetattr(xf86Info.consoleFd, TCSANOW, &tty_attr);
+    if (xf86Info.allowEmptyInput) {
+	ioctl(xf86Info.consoleFd, KDSKBMODE, tty_mode);
+	tcsetattr(xf86Info.consoleFd, TCSANOW, &tty_attr);
+    }
 
     if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0) 
 	xf86Msg(X_WARNING, "xf86CloseConsole: VT_GETMODE failed: %s\n",
-- 
1.6.0.4




More information about the xorg mailing list