xorg-x11-xinit/xinit-1.0.2-client-session.patch
Matthias Clasen b8aec5b45b rediff
2008-08-25 13:58:56 +00:00

27 lines
741 B
Diff

diff -up xinit-1.0.9/xinit.c.client-session xinit-1.0.9/xinit.c
--- xinit-1.0.9/xinit.c.client-session 2008-05-21 14:09:16.000000000 -0400
+++ xinit-1.0.9/xinit.c 2008-08-25 09:57:56.000000000 -0400
@@ -727,11 +727,21 @@ startClient(char *client[])
{
setWindowPath();
if ((clientpid = vfork()) == 0) {
+ int fd;
if (setuid(getuid()) == -1) {
Error("cannot change uid: %s\n", strerror(errno));
_exit(ERR_EXIT);
}
- setpgid(0, getpid());
+ fd = open ("/dev/null", O_RDONLY);
+
+ if (fd < 0) {
+ Error("cannot open /dev/null: %s\n", strerror(errno));
+ _exit(ERR_EXIT);
+ }
+ close (STDIN_FILENO);
+ dup2 (fd, STDIN_FILENO);
+ close (fd);
+ setsid();
environ = newenviron;
#ifdef __UNIXOS2__
#undef environ