From e0e7a74bde52a1aa02d1da758128722598fb6dd8 Mon Sep 17 00:00:00 2001 From: Matthias Andree Date: Sun, 25 Aug 2019 18:52:53 +0200 Subject: Align with legacy_6x. * Normalize include order. * Backport missed bug fixes. * Remove dead code. --- daemon.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'daemon.c') 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) -- cgit v1.2.3