virCommandWait: Propagate dryRunCallback return value properly

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>
This commit is contained in:
Michal Privoznik 2018-07-04 09:57:05 +02:00
parent adfcbdff91
commit c1a75828e4

View File

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