[libvirt] [PATCH v2 06/10] virCommandWait: Propagate dryRunCallback return value properly

Michal Privoznik mprivozn at redhat.com
Wed Jul 4 09:23:40 UTC 2018


The documentation to virCommandWait() function states that if
@exitstatus is NULL and command finished with error -1 is
returned. In other words, if @dryRunCallback is set and returns
an error (by setting its @status argument to a nonzero value) we
must propagate this error properly honouring the documentation
(and also regular run).

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/util/vircommand.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/util/vircommand.c b/src/util/vircommand.c
index 6dab105f56..13f75967fa 100644
--- a/src/util/vircommand.c
+++ b/src/util/vircommand.c
@@ -2553,6 +2553,8 @@ virCommandWait(virCommandPtr cmd, int *exitstatus)
                   dryRunStatus);
         if (exitstatus)
             *exitstatus = dryRunStatus;
+        else if (dryRunStatus)
+            return -1;
         return 0;
     }
 
-- 
2.16.4




More information about the libvir-list mailing list