Abort gkrellmd detaching if chdir fails

Handle the return value for chdir() and abort daemonizing of gkrellmd in
case chdir failed.
This commit is contained in:
Stefan Gehn 2012-02-22 19:44:27 +01:00
parent cdbeeb9b17
commit 1d11384131
1 changed files with 6 additions and 1 deletions

View File

@ -1098,7 +1098,12 @@ detach_from_terminal(void)
if (fd > 2) if (fd > 2)
close(fd); close(fd);
} }
chdir("/");
if (chdir("/") != 0)
{
g_warning("Detach failed in chdir(\"/\"): %s\n", strerror(errno));
return FALSE;
}
#endif /* HAVE_DAEMON */ #endif /* HAVE_DAEMON */
// signal(SIGCHLD, SIG_IGN); // signal(SIGCHLD, SIG_IGN);