diff options
Diffstat (limited to 'glusterfsd/src/glusterfsd.c')
-rw-r--r-- | glusterfsd/src/glusterfsd.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c index 3d54229d894..09ba9cd8086 100644 --- a/glusterfsd/src/glusterfsd.c +++ b/glusterfsd/src/glusterfsd.c @@ -2117,7 +2117,7 @@ daemonize (glusterfs_ctx_t *ctx) int ret = -1; cmd_args_t *cmd_args = NULL; int cstatus = 0; - int err = 0; + int err = 1; cmd_args = &ctx->cmd_args; @@ -2162,14 +2162,17 @@ daemonize (glusterfs_ctx_t *ctx) if (ctx->mnt_pid > 0) { ret = waitpid (ctx->mnt_pid, &cstatus, 0); - if (!(ret == ctx->mnt_pid && cstatus == 0)) { + if (!(ret == ctx->mnt_pid)) { + if (WIFEXITED(cstatus)) { + err = WEXITSTATUS(cstatus); + } else { + err = cstatus; + } gf_msg ("daemonize", GF_LOG_ERROR, 0, glusterfsd_msg_25); - exit (1); + exit (err); } } - - err = 1; sys_read (ctx->daemon_pipe[0], (void *)&err, sizeof (err)); _exit (err); } |