From dc174a4d60ebca6a67e32c1834c2f0dcbff2c3c0 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Thu, 22 Mar 2012 04:11:38 -0700 Subject: Revert "core: enable process to return the appropriate error code" This reverts commit 16717f4df7b0fbd3c255f5faf8a2744444231bb7 Change-Id: I65624db4d31e11e1bec66b07b352ce823ef069b9 Reviewed-on: http://review.gluster.com/3001 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- glusterfsd/src/glusterfsd.c | 43 +++---------------------------------------- 1 file changed, 3 insertions(+), 40 deletions(-) (limited to 'glusterfsd/src/glusterfsd.c') diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c index e3285658a99..053a7c2461a 100644 --- a/glusterfsd/src/glusterfsd.c +++ b/glusterfsd/src/glusterfsd.c @@ -387,7 +387,7 @@ err: xlator_destroy (master); } - return 1; + return -1; } @@ -865,16 +865,6 @@ reincarnate (int signum) return; } -void -emancipate (glusterfs_ctx_t *ctx, int ret) -{ - /* break free from the parent */ - if (ctx->daemon_pipe[1] != -1) { - write (ctx->daemon_pipe[1], (void *) &ret, sizeof (ret)); - close (ctx->daemon_pipe[1]); - ctx->daemon_pipe[1] = -1; - } -} static char * generate_uuid () @@ -1466,7 +1456,6 @@ daemonize (glusterfs_ctx_t *ctx) int ret = -1; cmd_args_t *cmd_args = NULL; int cstatus = 0; - int err = 0; cmd_args = &ctx->cmd_args; @@ -1480,36 +1469,15 @@ daemonize (glusterfs_ctx_t *ctx) if (cmd_args->debug_mode) goto postfork; - ret = pipe (ctx->daemon_pipe); - if (ret) { - /* If pipe() fails, retain daemon_pipe[] = {-1, -1} - and parent will just not wait for child status - */ - ctx->daemon_pipe[0] = -1; - ctx->daemon_pipe[1] = -1; - } - ret = os_daemon_return (0, 0); switch (ret) { case -1: - if (ctx->daemon_pipe[0] != -1) { - close (ctx->daemon_pipe[0]); - close (ctx->daemon_pipe[1]); - } - gf_log ("daemonize", GF_LOG_ERROR, "Daemonization failed: %s", strerror(errno)); goto out; case 0: - /* child */ - /* close read */ - close (ctx->daemon_pipe[0]); break; default: - /* parent */ - /* close write */ - close (ctx->daemon_pipe[1]); - if (ctx->mtab_pid > 0) { ret = waitpid (ctx->mtab_pid, &cstatus, 0); if (!(ret == ctx->mtab_pid && cstatus == 0)) { @@ -1518,10 +1486,7 @@ daemonize (glusterfs_ctx_t *ctx) exit (1); } } - - err = 1; - read (ctx->daemon_pipe[0], (void *)&err, sizeof (err)); - _exit (err); + _exit (0); } postfork: @@ -1603,8 +1568,7 @@ glusterfs_volumes_init (glusterfs_ctx_t *ctx) if (cmd_args->volfile_server) { ret = glusterfs_mgmt_init (ctx); - /* return, do not emancipate() yet */ - return ret; + goto out; } fp = get_volfp (ctx); @@ -1621,7 +1585,6 @@ glusterfs_volumes_init (glusterfs_ctx_t *ctx) goto out; out: - emancipate (ctx, ret); return ret; } -- cgit