summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCsaba Henk <csaba@redhat.com>2012-03-31 00:15:02 +0200
committerVijay Bellur <vijay@gluster.com>2012-04-02 22:39:28 -0700
commit943ca064ec6ab2f009f12b3d5f1e90a5402f04d6 (patch)
tree76cdb12597b178201dcc5f9251821c1c5970aa68
parent22cc617902794f4136fe6ba7b631ebe9f7bd4563 (diff)
libglusterfs/run: clean up properly also if program could not be spawned
Change-Id: Ie81a6e1a99c1cb002653c0175bb3c5fcff9c8a4a BUG: 808427 Reported-by: Krishnan Parthasarathi <kparthas@redhat.com> Signed-off-by: Csaba Henk <csaba@redhat.com> Reviewed-on: http://review.gluster.com/3055 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Krishnan Parthasarathi <kp@gluster.com>
-rw-r--r--libglusterfs/src/run.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libglusterfs/src/run.c b/libglusterfs/src/run.c
index 44ef2f0d739..0dbf33b9d96 100644
--- a/libglusterfs/src/run.c
+++ b/libglusterfs/src/run.c
@@ -364,9 +364,11 @@ runner_end (runner_t *runner)
ret = runner_end_reuse (runner);
- for (p = runner->argv; *p; p++)
- GF_FREE (*p);
- GF_FREE (runner->argv);
+ if (runner->argv) {
+ for (p = runner->argv; *p; p++)
+ GF_FREE (*p);
+ GF_FREE (runner->argv);
+ }
for (i = 0; i < 3; i++)
close (runner->chfd[i]);
@@ -379,10 +381,8 @@ runner_run_generic (runner_t *runner, int (*rfin)(runner_t *runner))
int ret = 0;
ret = runner_start (runner);
- if (ret != 0)
- return -1;
- return rfin (runner) ? -1 : 0;
+ return -(rfin (runner) || ret);
}
int