]> xenbits.xensource.com Git - libvirt.git/commitdiff
virCommandWait: Propagate dryRunCallback return value properly
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 4 Jul 2018 07:57:05 +0000 (09:57 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 25 Jul 2018 05:11:13 +0000 (07:11 +0200)
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@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
src/util/vircommand.c

index 8ba9c3563547a3412d7732e3730655e98eb99fb6..8be3fdffbc468dd255a5c96b1dd348a5181a09bf 100644 (file)
@@ -2542,6 +2542,8 @@ virCommandWait(virCommandPtr cmd, int *exitstatus)
                   dryRunStatus);
         if (exitstatus)
             *exitstatus = dryRunStatus;
+        else if (dryRunStatus)
+            return -1;
         return 0;
     }