SHA256
1
0
forked from pool/xinit
xinit/xinit-client-session.patch

39 lines
1.0 KiB
Diff

--- xinit-1.3.0/xinit.c.orig 2010-06-12 03:14:10.000000000 +0200
+++ xinit-1.3.0/xinit.c 2010-10-31 04:32:20.000000000 +0100
@@ -91,6 +91,7 @@ char xserverrcbuf[256];
#define TRUE 1
#define FALSE 0
+#define ERR_EXIT 1
static char *default_server = "X";
static char *default_display = ":0"; /* choose most efficient */
@@ -562,6 +562,8 @@ startClient(char *client[])
{
clientpid = fork();
if (clientpid == 0) {
+ int fd;
+
set_environment();
setWindowPath();
@@ -569,7 +571,17 @@ 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(ERR_EXIT);
+ }
+ close (STDIN_FILENO);
+ dup2 (fd, STDIN_FILENO);
+ close (fd);
+ setsid();
+
Execute(client);
Error("Unable to run program \"%s\"", client[0]);