daemon: print fork error message

Print details on why the fork() fails.
This commit is contained in:
Max Kellermann 2009-02-15 16:27:50 +01:00
parent fd8c63b619
commit 42415592b4

View File

@ -134,10 +134,11 @@ daemonize_detach(void)
fflush(NULL);
pid = fork();
if (pid < 0)
g_error("fork() failed: %s", g_strerror(errno));
if (pid > 0)
_exit(EXIT_SUCCESS);
else if (pid < 0)
g_error("problems fork'ing for daemon!");
if (chdir("/") < 0)
g_error("problems changing to root directory");