From f5878521ab1689d0e7d43a2db3971cdd471f3b38 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Mon, 11 Jul 2005 20:07:24 +0000 Subject: [PATCH] Make sure that bpipe results are zapped even on error return. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2190 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/kes-1.37 | 2 ++ bacula/src/lib/bpipe.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/bacula/kes-1.37 b/bacula/kes-1.37 index 0967cdf55f..10716a5828 100644 --- a/bacula/kes-1.37 +++ b/bacula/kes-1.37 @@ -5,6 +5,8 @@ General: Changes to 1.37.28: 11Jul05 +- Make sure that bpipe results are zapped even on + error return. - Lots of documentation. - Do not prune volume marked as append when needing a new Volume. diff --git a/bacula/src/lib/bpipe.c b/bacula/src/lib/bpipe.c index 1002e70ba6..4a9eb97887 100644 --- a/bacula/src/lib/bpipe.c +++ b/bacula/src/lib/bpipe.c @@ -255,13 +255,15 @@ int run_program(char *prog, int wait, POOLMEM *results) int stat1, stat2; char *mode; + if (results) { + results[0] = 0; + } mode = (char *)(results != NULL ? "r" : ""); bpipe = open_bpipe(prog, wait, mode); if (!bpipe) { return ENOENT; } if (results) { - results[0] = 0; fgets(results, sizeof_pool_memory(results), bpipe->rfd); if (feof(bpipe->rfd)) { stat1 = 0; -- 2.39.5