diff options
author | Laine Stump <laine@laine.org> | 2012-08-24 01:43:19 -0400 |
---|---|---|
committer | Laine Stump <laine@laine.org> | 2012-08-24 03:07:00 -0400 |
commit | 46dc643232089e275ece27fef66f441be99d242d (patch) | |
tree | 9ba6a0351505c48bee704c1d3d40b0283b34f252 /src | |
parent | qemu-agent: available in 0.10.0 (diff) | |
download | libvirt-46dc643232089e275ece27fef66f441be99d242d.tar.gz libvirt-46dc643232089e275ece27fef66f441be99d242d.tar.bz2 libvirt-46dc643232089e275ece27fef66f441be99d242d.zip |
openvz: check the exitstatus of vzlist
I noticed this while auditing all calls to virCommandRun that request
an exit status from virCommandRun. Two functions in the openvz driver
openvzDomainGetBarrierLimit
openvzDomainSetBarrierLimit
request an exit status from virCommandRun (thus assuring that
virCommandRun won't log any errors just due to a non-0 exit status),
but then fail to examine that exit status. This could result in the
functions believing that the call to "vzlist" was successful, even
though it may have encountered an error.
Diffstat (limited to 'src')
-rw-r--r-- | src/openvz/openvz_driver.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index 8257ed560..a1d3b42b4 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -1707,7 +1707,7 @@ openvzDomainGetBarrierLimit(virDomainPtr domain, virCommandSetOutputBuffer(cmd, &output); virCommandAddArgFormat(cmd, "-o%s.b,%s.l", param, param); virCommandAddArg(cmd, domain->name); - if (virCommandRun(cmd, &status)) { + if (virCommandRun(cmd, &status) < 0 || status != 0) { virReportError(VIR_ERR_OPERATION_FAILED, _("Failed to get %s for %s: %d"), param, domain->name, status); @@ -1758,7 +1758,7 @@ openvzDomainSetBarrierLimit(virDomainPtr domain, virCommandAddArgFormat(cmd, "--%s", param); virCommandAddArgFormat(cmd, "%llu:%llu", barrier, limit); virCommandAddArg(cmd, "--save"); - if (virCommandRun(cmd, &status)) { + if (virCommandRun(cmd, &status) < 0 || status != 0) { virReportError(VIR_ERR_OPERATION_FAILED, _("Failed to set %s for %s: %d"), param, domain->name, status); |