Don't ignore retval of chdir()

This commit is contained in:
Mukund Sivaraman 2009-09-23 07:08:45 +05:30
parent 50c781d0c9
commit d102ed4ed3

View File

@ -24,6 +24,7 @@
#include "main.h" #include "main.h"
#include "daemon.h" #include "daemon.h"
#include "log.h"
/* /*
* Fork a child process and then kill the parent so make the calling * Fork a child process and then kill the parent so make the calling
@ -40,7 +41,11 @@ void makedaemon (void)
if (fork () != 0) if (fork () != 0)
exit (0); exit (0);
chdir ("/"); if (chdir ("/") != 0) {
log_message (LOG_WARNING,
"Could not change directory to /");
}
umask (0177); umask (0177);
#if NDEBUG #if NDEBUG