Sophie

Sophie

distrib > Mandriva > 2010.0 > x86_64 > media > main-testing-src > by-pkgid > df5da2d17b5d75fa67e6b0793d622f0f > files > 2

xinit-1.1.0-5.1mdv2010.0.src.rpm

--- xinit-1.0.4/xinit.c.client-session	2007-07-30 17:28:48.000000000 +0200
+++ xinit-1.0.4/xinit.c	2007-07-30 17:30:04.000000000 +0200
@@ -766,11 +766,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