Detach from the TTY properly.

This commit is contained in:
Martin Mares 2007-06-20 07:33:26 +00:00
parent 4b1cf69e76
commit 8411a37e7d

View file

@ -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();