aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/os-support/linux/lnx_init.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-03-09 21:32:55 +0100
committermarha <marha@users.sourceforge.net>2014-03-09 21:32:55 +0100
commit3dd4b6420f686b0147d5b8136268cc63196e253b (patch)
tree2c81c3f7503dbcfb5b64fd95b40bb1c2204598ef /xorg-server/hw/xfree86/os-support/linux/lnx_init.c
parent321c01267ae1c446f1bd22b642567fcafa016c02 (diff)
downloadvcxsrv-3dd4b6420f686b0147d5b8136268cc63196e253b.tar.gz
vcxsrv-3dd4b6420f686b0147d5b8136268cc63196e253b.tar.bz2
vcxsrv-3dd4b6420f686b0147d5b8136268cc63196e253b.zip
fontconfig mesa xserver git update 9 Mar 2014
xserver commit 1c61d38528a573caadee2468ee59ea558c822e09 fontconfig commit f8ccf379eb1092592ae0b65deb563c5491f69de9 mesa commit 897f40f25d21af678b1b67c1a68c4a6722d19983
Diffstat (limited to 'xorg-server/hw/xfree86/os-support/linux/lnx_init.c')
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnx_init.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_init.c b/xorg-server/hw/xfree86/os-support/linux/lnx_init.c
index 46438e655..85709c629 100644
--- a/xorg-server/hw/xfree86/os-support/linux/lnx_init.c
+++ b/xorg-server/hw/xfree86/os-support/linux/lnx_init.c
@@ -79,20 +79,15 @@ switch_to(int vt, const char *from)
void
xf86OpenConsole(void)
{
- int i, fd = -1, ret;
+ int i, fd = -1, ret, current_vt = -1;
struct vt_mode VT;
struct vt_stat vts;
+ struct stat st;
MessageType from = X_PROBED;
const char *tty0[] = { "/dev/tty0", "/dev/vc/0", NULL };
const char *vcs[] = { "/dev/vc/%d", "/dev/tty%d", NULL };
if (serverGeneration == 1) {
-
- /* when KeepTty check if we're run with euid==0 */
- if (KeepTty && geteuid() != 0)
- FatalError("xf86OpenConsole:"
- " Server must be suid root for option \"KeepTTY\"\n");
-
/*
* setup the virtual terminal manager
*/
@@ -132,6 +127,22 @@ xf86OpenConsole(void)
xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno);
+ /* Some of stdin / stdout / stderr maybe redirected to a file */
+ for (i = STDIN_FILENO; i <= STDERR_FILENO; i++) {
+ ret = fstat(i, &st);
+ if (ret == 0 && S_ISCHR(st.st_mode) && major(st.st_rdev) == 4) {
+ current_vt = minor(st.st_rdev);
+ break;
+ }
+ }
+
+ if (!KeepTty && current_vt == xf86Info.vtno) {
+ xf86Msg(X_PROBED,
+ "controlling tty is VT number %d, auto-enabling KeepTty\n",
+ current_vt);
+ KeepTty = TRUE;
+ }
+
if (!KeepTty) {
pid_t ppid = getppid();
pid_t ppgid;