From: Martin Mares Date: Wed, 20 Jun 2007 07:33:26 +0000 (+0000) Subject: Detach from the TTY properly. X-Git-Tag: v1.2.0~207 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8411a37e7dc72a5fd2e4fb68d1c557dc89253973;p=thirdparty%2Fbird.git Detach from the TTY properly. --- diff --git a/sysdep/unix/main.c b/sysdep/unix/main.c index 335f42a19..da1ba37f3 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();