Blame SOURCES/xinit-1.0.2-client-session.patch
|
|
741de5 |
Index: xinit-1.3.1/xinit.c
|
|
|
741de5 |
===================================================================
|
|
|
741de5 |
--- xinit-1.3.1.orig/xinit.c
|
|
|
741de5 |
+++ xinit-1.3.1/xinit.c
|
|
|
741de5 |
@@ -91,6 +91,8 @@ char xserverrcbuf[256];
|
|
|
741de5 |
|
|
|
741de5 |
#define TRUE 1
|
|
|
741de5 |
#define FALSE 0
|
|
|
741de5 |
+#define OK_EXIT 0
|
|
|
741de5 |
+#define ERR_EXIT 1
|
|
|
741de5 |
|
|
|
741de5 |
static char *default_server = "X";
|
|
|
741de5 |
static char *default_display = ":0"; /* choose most efficient */
|
|
|
741de5 |
@@ -561,6 +563,7 @@ startClient(char *client[])
|
|
|
741de5 |
{
|
|
|
741de5 |
clientpid = fork();
|
|
|
741de5 |
if (clientpid == 0) {
|
|
|
741de5 |
+ int fd;
|
|
|
741de5 |
set_environment();
|
|
|
741de5 |
setWindowPath();
|
|
|
741de5 |
|
|
|
741de5 |
@@ -568,7 +571,16 @@ startClient(char *client[])
|
|
|
741de5 |
Error("cannot change uid");
|
|
|
741de5 |
_exit(EXIT_FAILURE);
|
|
|
741de5 |
}
|
|
|
741de5 |
- setpgid(0, getpid());
|
|
|
741de5 |
+ fd = open ("/dev/null", O_RDONLY);
|
|
|
741de5 |
+
|
|
|
741de5 |
+ if (fd < 0) {
|
|
|
741de5 |
+ Error("cannot open /dev/null: %s\n", strerror(errno));
|
|
|
741de5 |
+ _exit(ERR_EXIT);
|
|
|
741de5 |
+ }
|
|
|
741de5 |
+ close (STDIN_FILENO);
|
|
|
741de5 |
+ dup2 (fd, STDIN_FILENO);
|
|
|
741de5 |
+ close (fd);
|
|
|
741de5 |
+ setsid();
|
|
|
741de5 |
Execute(client);
|
|
|
741de5 |
Error("Unable to run program \"%s\"", client[0]);
|
|
|
741de5 |
|