Blame SOURCES/xinit-1.0.2-client-session.patch

3c096a
diff -up xinit-1.3.4/xinit.c.client-session xinit-1.3.4/xinit.c
3c096a
--- xinit-1.3.4/xinit.c.client-session	2014-03-25 10:20:26.000000000 +0100
3c096a
+++ xinit-1.3.4/xinit.c	2014-09-11 17:03:30.928360694 +0200
3c096a
@@ -89,6 +89,8 @@ char xserverrcbuf[256];
3c096a
 
3c096a
 #define TRUE 1
3c096a
 #define FALSE 0
3c096a
+#define OK_EXIT 0
3c096a
+#define ERR_EXIT 1
3c096a
 
3c096a
 static char *default_server = "X";
3c096a
 static char *default_display = ":0";        /* choose most efficient */
3c096a
@@ -560,6 +562,7 @@ startClient(char *client_argv[])
3c096a
 {
3c096a
     clientpid = fork();
3c096a
     if (clientpid == 0) {
3c096a
+        int fd;
3c096a
         set_environment();
3c096a
         setWindowPath();
3c096a
 
3c096a
@@ -567,7 +570,16 @@ startClient(char *client_argv[])
3c096a
             Error("cannot change uid");
3c096a
             _exit(EXIT_FAILURE);
3c096a
         }
3c096a
-        setpgid(0, getpid());
3c096a
+        fd = open ("/dev/null", O_RDONLY);
3c096a
+
3c096a
+        if (fd < 0) {
3c096a
+            Error("cannot open /dev/null: %s\n", strerror(errno));
3c096a
+            _exit(ERR_EXIT);
3c096a
+        }
3c096a
+        close (STDIN_FILENO);
3c096a
+        dup2 (fd, STDIN_FILENO);
3c096a
+        close (fd);
3c096a
+        setsid();
3c096a
         Execute(client_argv);
3c096a
         Error("Unable to run program \"%s\"", client_argv[0]);
3c096a