daemon: don't fork twice to daemonize

To detach from the parent process, fork once and make the old process
exit.  No need to do that twice.
This commit is contained in:
Max Kellermann 2009-01-13 21:44:42 +01:00
parent d8fc8ca7ba
commit 2532129755

View File

@ -79,14 +79,6 @@ daemonize(Options *options)
g_error("problems setsid'ing");
}
fflush(NULL);
pid = fork();
if (pid > 0)
_exit(EXIT_SUCCESS);
else if (pid < 0) {
g_error("problems fork'ing for daemon!");
}
g_debug("daemonized!");
}