Sophie

Sophie

distrib > Mageia > 3 > i586 > media > core-release-src > by-pkgid > c294b4eebf6feb078f309dbd94dd23cc > files > 1

xinit-1.3.2-5.mga3.src.rpm

diff --git a/xinit.c b/xinit.c
index 0d31637..b5a1ca8 100644
--- a/xinit.c
+++ b/xinit.c
@@ -562,6 +562,7 @@ startClient(char *client[])
 {
     clientpid = fork();
     if (clientpid == 0) {
+        int fd;
         set_environment();
         setWindowPath();
 
@@ -569,7 +570,18 @@ startClient(char *client[])
             Error("cannot change uid");
             _exit(EXIT_FAILURE);
         }
-        setpgid(0, getpid());
+
+        fd = open ("/dev/null", O_RDONLY);
+
+        if (fd < 0) {
+                Error("cannot open /dev/null: %s\n", strerror(errno));
+                _exit(EXIT_FAILURE);
+        }
+        close (STDIN_FILENO);
+        dup2 (fd, STDIN_FILENO);
+        close (fd);
+        setsid();
+
         Execute(client);
         Error("Unable to run program \"%s\"", client[0]);