summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorCsaba Henk <csaba@gluster.com>2011-03-31 11:59:52 +0000
committerVijay Bellur <vijay@dev.gluster.com>2011-04-01 11:19:17 -0700
commitf007eb1a0701cd3e13e6ba67208cd1db9325a370 (patch)
tree6d9ba72988a989f2b6e5e061d5f08669ccd95451 /cli
parent913da6c337cfe342d60f3773057a14d645248421 (diff)
syncdaemon; adding corresponding pcloses to gsyncd invocation via popen
Signed-off-by: Csaba Henk <csaba@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 2427 (set a proper default for remote syncdaemon) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2427
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-rpc-ops.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index 17d82a0074a..6d47374a0c1 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