2014-09-11 17:47:04 +00:00
|
|
|
diff -up xinit-1.3.4/xinit.c.client-session xinit-1.3.4/xinit.c
|
|
|
|
--- xinit-1.3.4/xinit.c.client-session 2014-03-25 10:20:26.000000000 +0100
|
|
|
|
+++ xinit-1.3.4/xinit.c 2014-09-11 17:03:30.928360694 +0200
|
|
|
|
@@ -89,6 +89,8 @@ char xserverrcbuf[256];
|
2011-07-25 18:28:41 +00:00
|
|
|
|
|
|
|
#define TRUE 1
|
|
|
|
#define FALSE 0
|
|
|
|
+#define OK_EXIT 0
|
|
|
|
+#define ERR_EXIT 1
|
|
|
|
|
|
|
|
static char *default_server = "X";
|
|
|
|
static char *default_display = ":0"; /* choose most efficient */
|
2014-09-11 17:47:04 +00:00
|
|
|
@@ -560,6 +562,7 @@ startClient(char *client_argv[])
|
2006-11-10 15:31:06 +00:00
|
|
|
{
|
2011-07-25 18:28:41 +00:00
|
|
|
clientpid = fork();
|
|
|
|
if (clientpid == 0) {
|
2014-09-11 17:47:04 +00:00
|
|
|
+ int fd;
|
2011-07-25 18:28:41 +00:00
|
|
|
set_environment();
|
|
|
|
setWindowPath();
|
|
|
|
|
2014-09-11 17:47:04 +00:00
|
|
|
@@ -567,7 +570,16 @@ startClient(char *client_argv[])
|
2011-07-25 18:28:41 +00:00
|
|
|
Error("cannot change uid");
|
|
|
|
_exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
- setpgid(0, getpid());
|
2014-09-11 17:47:04 +00:00
|
|
|
+ fd = open ("/dev/null", O_RDONLY);
|
2006-11-10 15:31:06 +00:00
|
|
|
+
|
2014-09-11 17:47:04 +00:00
|
|
|
+ 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();
|
|
|
|
Execute(client_argv);
|
|
|
|
Error("Unable to run program \"%s\"", client_argv[0]);
|
2011-07-25 18:28:41 +00:00
|
|
|
|