aboutsummaryrefslogtreecommitdiffstats
path: root/daemon.c
diff options
context:
space:
mode:
Diffstat (limited to 'daemon.c')
-rw-r--r--daemon.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/daemon.c b/daemon.c
index 58dee539..53bc4dcb 100644
--- a/daemon.c
+++ b/daemon.c
@@ -238,12 +238,15 @@ nottyDetach:
if (dup(logfd) < 0 /* stdout */
|| ((logfd == 0 || logfd >= 3) && dup(logfd) < 0)) { /* stderr */
- report(stderr, "dup (%s)\n", strerror(errno));
+ report(stderr, "dup(): %s\n", strerror(errno));
return(PS_IOERR);
}
/* move to root directory, so we don't prevent filesystem unmounts */
- chdir("/");
+ if (chdir("/")) {
+ report(stderr, "chdir(\"/\"): %s\n", strerror(errno));
+ return PS_IOERR;
+ }
/* set our umask to something reasonable (we hope) */
#if defined(DEF_UMASK)