[PATCH 3/3] linux: xf86OpenConsole: Don't detach from tty when running on the active tty

Hans de Goede hdegoede at redhat.com
Thu Jan 16 02:24:51 PST 2014


Detaching from the tty makes little sense when asked to run on the same tty
as we're started from. So automatically assume -keeptty in this case.

This is useful to do because when not running as root the server can only make
various VT related ioctls when it does not detach from the tty.

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 hw/xfree86/os-support/linux/lnx_init.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c
index 5f7d39b..52e629b 100644
--- a/hw/xfree86/os-support/linux/lnx_init.c
+++ b/hw/xfree86/os-support/linux/lnx_init.c
@@ -149,6 +149,10 @@ xf86OpenConsole(void)
         else
             activeVT = vts.v_active;
 
+        /* Don't detach from the tty when started on the active tty */
+        if (xf86Info.vtno == activeVT)
+            KeepTty = TRUE;
+
         if (!KeepTty) {
             pid_t ppid = getppid();
             pid_t ppgid;
-- 
1.8.4.2



More information about the xorg-devel mailing list