aboutsummaryrefslogtreecommitdiff
path: root/src/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/utils.c b/src/utils.c
index 0979622..3cf88d5 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -297,7 +297,8 @@ pid_t daemonize(int stay_foreground)
if (!stay_foreground) {
/* Change the working directory to the root directory */
/* or another appropriated directory */
- chdir("/");
+ if (chdir("/"))
+ return -1;
/* Close all open file descriptors */
assert( close_fds_except(-1) == 0 );
assert( redirect_devnull_to(0, 1, 2, -1) == 0 );