summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cli/src/cli-rpc-ops.c18
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c18
2 files changed, 20 insertions, 16 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index 17d82a007..6d47374a0 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -2610,6 +2610,7 @@ gf_cli3_1_gsync_get_pid_file (char *pidfolder, char *pidfile, char *master, char
char cmd[PATH_MAX] = {0, };
char *ptr = NULL;
char buffer[PATH_MAX] = {0, };
+ int ret = 0;
snprintf (cmd, PATH_MAX, GSYNCD_PREFIX"/gsyncd --canonicalize-escape-url"
" %s %s", master, slave);
@@ -2623,10 +2624,9 @@ gf_cli3_1_gsync_get_pid_file (char *pidfolder, char *pidfile, char *master, char
buff[strlen(buff)-1]='\0'; //strip off \n
snprintf (buffer, PATH_MAX, "%s/gsync/%s", gl_workdir, buff);
strncpy (pidfolder, buffer, PATH_MAX);
- }
- else {
- gf_log ("", GF_LOG_ERROR, "popen failed");
- return -1;
+ } else {
+ ret = -1;
+ goto out;
}
memset (buff, 0, PATH_MAX);
@@ -2638,12 +2638,14 @@ gf_cli3_1_gsync_get_pid_file (char *pidfolder, char *pidfile, char *master, char
snprintf (buffer, PATH_MAX, "%s/%s.pid", pidfolder, buff);
strncpy (pidfile, buffer, PATH_MAX);
}
- else {
+
+ out:
+ ret |= pclose (in);
+
+ if (ret)
gf_log ("", GF_LOG_ERROR, "popen failed");
- return -1;
- }
- return 0;
+ return ret ? -1 : 0;
}
/* status: 0 when gsync is running
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 849ee5314..f8e043e46 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -1704,6 +1704,7 @@ glusterd_gsync_get_pid_file (char *pidfile, char *master, char *slave)
char buffer[PATH_MAX] = {0, };
char pidfolder[PATH_MAX] = {0, };
glusterd_conf_t *priv = NULL;
+ int ret = 0;
GF_ASSERT (THIS);
@@ -1721,10 +1722,9 @@ glusterd_gsync_get_pid_file (char *pidfile, char *master, char *slave)
buff[strlen(buff)-1]='\0'; //strip off \n
snprintf (buffer, PATH_MAX, "%s/gsync/%s", priv->workdir, buff);
strncpy (pidfolder, buffer, PATH_MAX);
- }
- else {
- gf_log ("", GF_LOG_ERROR, "popen failed");
- return -1;
+ } else {
+ ret = -1;
+ goto out;
}
memset (buff, 0, PATH_MAX);
@@ -1736,12 +1736,14 @@ glusterd_gsync_get_pid_file (char *pidfile, char *master, char *slave)
snprintf (buffer, PATH_MAX, "%s/%s.pid", pidfolder, buff);
strncpy (pidfile, buffer, PATH_MAX);
}
- else {
+
+ out:
+ ret |= pclose (in);
+
+ if (ret)
gf_log ("", GF_LOG_ERROR, "popen failed");
- return -1;
- }
- return 0;
+ return ret ? -1 : 0;
}
/* status: return 0 when gsync is running