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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux