diff options
author | Adam Jackson <ajax@redhat.com> | 2010-05-10 18:40:09 -0400 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2010-11-30 13:28:28 -0500 |
commit | 96a7a7d197d5f96e7aa51928155d4b8d5a115875 (patch) | |
tree | 6d13eb5bd97beeb44c87df02f1d7611f8e65a317 /hw/xfree86/os-support | |
parent | 6ce1908ba4959aaa0a48171acb62cf6a5d5cbf18 (diff) |
linux: Don't muck about with tty permissions
This is not X's job.
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'hw/xfree86/os-support')
-rw-r--r-- | hw/xfree86/os-support/linux/lnx_init.c | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c index 9b50ccd2b..58051d7c9 100644 --- a/hw/xfree86/os-support/linux/lnx_init.c +++ b/hw/xfree86/os-support/linux/lnx_init.c @@ -43,42 +43,10 @@ static Bool VTSwitch = TRUE; static Bool ShareVTs = FALSE; static int activeVT = -1; -static int vtPermSave[4]; static char vtname[11]; static struct termios tty_attr; /* tty state to restore */ static int tty_mode; /* kbd mode to restore */ -static int -saveVtPerms(void) -{ - /* We need to use stat to get permissions. */ - struct stat svtp; - - /* Do them numerically ordered, hard coded tty0 first. */ - if (stat("/dev/tty0", &svtp) != 0) - return 0; - vtPermSave[0] = (int)svtp.st_uid; - vtPermSave[1] = (int)svtp.st_gid; - - /* Now check the console we are dealing with. */ - if (stat(vtname, &svtp) != 0) - return 0; - vtPermSave[2] = (int)svtp.st_uid; - vtPermSave[3] = (int)svtp.st_gid; - - return 1; -} - -static void -restoreVtPerms(void) -{ - if (geteuid() == 0) { - /* Set the terminal permissions back to before we started. */ - (void)chown("/dev/tty0", vtPermSave[0], vtPermSave[1]); - (void)chown(vtname, vtPermSave[2], vtPermSave[3]); - } -} - static void *console_handler; static void @@ -177,34 +145,6 @@ xf86OpenConsole(void) FatalError("xf86OpenConsole: Cannot open virtual console" " %d (%s)\n", xf86Info.vtno, strerror(errno)); - if (!ShareVTs) - { - /* - * Grab the vt ownership before we overwrite it. - * Hard coded /dev/tty0 into this function as well for below. - */ - if (!saveVtPerms()) - xf86Msg(X_WARNING, - "xf86OpenConsole: Could not save ownership of VT\n"); - - if (geteuid() == 0) { - /* change ownership of the vt */ - if (chown(vtname, getuid(), getgid()) < 0) - xf86Msg(X_WARNING,"xf86OpenConsole: chown %s failed: %s\n", - vtname, strerror(errno)); - - /* - * the current VT device we're running on is not - * "console", we want to grab all consoles too - * - * Why is this needed?? - */ - if (chown("/dev/tty0", getuid(), getgid()) < 0) - xf86Msg(X_WARNING,"xf86OpenConsole: chown /dev/tty0 failed: %s\n", - strerror(errno)); - } - } - /* * Linux doesn't switch to an active vt after the last close of a vt, * so we do this ourselves by remembering which is active now. @@ -352,8 +292,6 @@ xf86CloseConsole(void) } } close(xf86Info.consoleFd); /* make the vt-manager happy */ - - restoreVtPerms(); /* restore the permissions */ } int |