diff options
author | Martin Mares <mj@ucw.cz> | 2007-06-20 07:33:26 +0000 |
---|---|---|
committer | Martin Mares <mj@ucw.cz> | 2007-06-20 07:33:26 +0000 |
commit | 8411a37e7dc72a5fd2e4fb68d1c557dc89253973 (patch) | |
tree | c3c9738aca6705abf8aa0901c33be186a86073b5 /sysdep | |
parent | 4b1cf69e765b19ebc0cb988be08910c156c76376 (diff) |
Detach from the TTY properly.
Diffstat (limited to 'sysdep')
-rw-r--r-- | sysdep/unix/main.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sysdep/unix/main.c b/sysdep/unix/main.c index 335f42a1..da1ba37f 100644 --- a/sysdep/unix/main.c +++ b/sysdep/unix/main.c @@ -435,6 +435,11 @@ main(int argc, char **argv) if (pid) return 0; setsid(); + close(0); + if (open("/dev/null", O_RDWR) < 0) + die("Cannot open /dev/null: %m"); + dup2(0, 1); + dup2(0, 2); } signal_init(); |