Fix error reporting in virNetDevVethDelete

In virNetDevVethDelete the virRun method will properly report
errors, but when checking the exit status for non-zero exit
code no error is reported

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit 0584d6626b07a55ede81d7ffde9565e9a305c172)
This commit is contained in:
Daniel P. Berrange 2012-11-27 12:35:49 +00:00 committed by Cole Robinson
parent dd35c8dadd
commit e69aaf2f7e

View File

@ -162,24 +162,9 @@ cleanup:
*/ */
int virNetDevVethDelete(const char *veth) int virNetDevVethDelete(const char *veth)
{ {
int rc;
const char *argv[] = {"ip", "link", "del", veth, NULL}; const char *argv[] = {"ip", "link", "del", veth, NULL};
int cmdResult = 0;
VIR_DEBUG("veth: %s", veth); VIR_DEBUG("veth: %s", veth);
rc = virRun(argv, &cmdResult); return virRun(argv, NULL);
if (rc != 0 ||
(WIFEXITED(cmdResult) && WEXITSTATUS(cmdResult) != 0)) {
/*
* Prevent overwriting an error log which may be set
* where an actual failure occurs.
*/
VIR_DEBUG("Failed to delete '%s' (%d)",
veth, WEXITSTATUS(cmdResult));
rc = -1;
}
return rc;
} }