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:
parent
d8fc8ca7ba
commit
2532129755
@ -79,14 +79,6 @@ daemonize(Options *options)
|
|||||||
g_error("problems setsid'ing");
|
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!");
|
g_debug("daemonized!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user