summaryrefslogtreecommitdiff
path: root/sysdep/unix
diff options
context:
space:
mode:
Diffstat (limited to 'sysdep/unix')
-rw-r--r--sysdep/unix/main.c5
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();