diff options
author | Martin Mares <mj@ucw.cz> | 2007-06-20 09:33:26 +0200 |
---|---|---|
committer | Martin Mares <mj@ucw.cz> | 2007-06-20 09:33:26 +0200 |
commit | 8411a37e7dc72a5fd2e4fb68d1c557dc89253973 (patch) | |
tree | c3c9738aca6705abf8aa0901c33be186a86073b5 /sysdep/unix | |
parent | 4b1cf69e765b19ebc0cb988be08910c156c76376 (diff) | |
download | bird-8411a37e7dc72a5fd2e4fb68d1c557dc89253973.tar bird-8411a37e7dc72a5fd2e4fb68d1c557dc89253973.zip |
Detach from the TTY properly.
Diffstat (limited to 'sysdep/unix')
-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 335f42a..da1ba37 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(); |