diff options
author | Anas Nashif <anas.nashif@intel.com> | 2012-11-10 07:08:08 -0800 |
---|---|---|
committer | Anas Nashif <anas.nashif@intel.com> | 2012-11-10 07:08:08 -0800 |
commit | 3f36a809de678457b68a87f225d3fc86aeb804e5 (patch) | |
tree | e0f4a49f7c3e3556b0d68b8ac117fc45429c56f4 | |
parent | dfe6a216e0d5eaff3f16607190eaef2f7058aef8 (diff) | |
download | xinit-3f36a809de678457b68a87f225d3fc86aeb804e5.tar.gz xinit-3f36a809de678457b68a87f225d3fc86aeb804e5.tar.bz2 xinit-3f36a809de678457b68a87f225d3fc86aeb804e5.zip |
client session
-rw-r--r-- | xinit.c | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -89,6 +89,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 */ @@ -559,6 +560,8 @@ startClient(char *client[]) { clientpid = fork(); if (clientpid == 0) { + int fd; + set_environment(); setWindowPath(); @@ -566,7 +569,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]); |