summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/run.c
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs/src/run.c')
-rw-r--r--libglusterfs/src/run.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/libglusterfs/src/run.c b/libglusterfs/src/run.c
index 70ebcc54fb6..c625a5b99de 100644
--- a/libglusterfs/src/run.c
+++ b/libglusterfs/src/run.c
@@ -339,13 +339,13 @@ int
runner_end_reuse (runner_t *runner)
{
int i = 0;
- int ret = -1;
+ int ret = 1;
int chstat = 0;
if (runner->chpid > 0) {
if (waitpid (runner->chpid, &chstat, 0) == runner->chpid) {
if (WIFEXITED(chstat)) {
- ret = -WEXITSTATUS(chstat);
+ ret = WEXITSTATUS(chstat);
} else {
ret = chstat;
}
@@ -359,7 +359,7 @@ runner_end_reuse (runner_t *runner)
}
}
- return ret;
+ return -ret;
}
int
@@ -388,8 +388,12 @@ runner_run_generic (runner_t *runner, int (*rfin)(runner_t *runner))
int ret = 0;
ret = runner_start (runner);
+ if (ret)
+ goto out;
+ ret = rfin (runner);
- return -(rfin (runner) || ret);
+out:
+ return ret;
}
int
return -1;
- }
gf_dump_fd = dump_fd;
return 0;
@@ -104,8 +101,6 @@ gf_proc_dump_add_section (char *key, ...)
snprintf (buf + strlen(buf),
GF_DUMP_MAX_BUF_LEN - strlen (buf), "]\n");
ret = write (gf_dump_fd, buf, strlen (buf));
- if (ret < 0)
- gf_log("", GF_LOG_ERROR, "write error: %s", strerror(errno));
}
@@ -133,8 +128,6 @@ gf_proc_dump_write (char *key, char *value,...)
offset = strlen (buf);
snprintf (buf + offset, GF_DUMP_MAX_BUF_LEN - offset, "\n");
ret = write (gf_dump_fd, buf, strlen (buf));
- if (ret < 0)
- gf_log("", GF_LOG_ERROR, "write error: %s", strerror(errno));
}
static void
@@ -220,8 +213,7 @@ gf_proc_dump_xlator_info (xlator_t *this_xl)
return;
if (ctx->master){
-
- gf_log ("", GF_LOG_DEBUG, "Dumping Proc for fuse Xlator");
+
fuse_xlator = (xlator_t *) ctx->master;
if (!fuse_xlator->dumpops)
@@ -286,7 +278,7 @@ gf_proc_dump_parse_set_option (char *key, char *value)
{
gf_boolean_t *opt_key = NULL;
gf_boolean_t opt_value = _gf_false;
-
+ char buf[GF_DUMP_MAX_BUF_LEN];
if (!strncasecmp (key, "mem", 3)) {
opt_key = &dump_options.dump_mem;
@@ -304,8 +296,10 @@ gf_proc_dump_parse_set_option (char *key, char *value)
if (!opt_key) {
//None of dump options match the key, return back
- gf_log ("", GF_LOG_WARNING, "None of the options matched key"
- ": %s", key);
+ snprintf (buf, sizeof (buf), "[Warning]:None of the options "
+ "matched key : %s\n", key);
+ write (gf_dump_fd, buf, strlen (buf));
+
return -1;
}
@@ -353,6 +347,7 @@ gf_proc_dump_options_init ()
int ret = -1;
FILE *fp = NULL;
char buf[256];
+ char dumpbuf[GF_DUMP_MAX_BUF_LEN];
char *key = NULL, *value = NULL;
char *saveptr = NULL;
@@ -384,8 +379,8 @@ gf_proc_dump_options_init ()
continue;
}
- gf_log ("", GF_LOG_DEBUG, "key = %s, value = %s",
- key, value);
+ snprintf (dumpbuf, sizeof (dumpbuf), "[Debug]:key=%s, value=%s\n",key,value);
+ write (gf_dump_fd, dumpbuf, strlen (dumpbuf));
gf_proc_dump_parse_set_option (key, value);