From: "Daniel P. Berrange" <berrange(a)redhat.com>
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(a)redhat.com>
---
po/POTFILES.in | 1 +
src/util/virnetdevveth.c | 19 +++++++++----------
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 1b7640c..32e7525 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -159,6 +159,7 @@ src/util/virnetdevbridge.c
src/util/virnetdevmacvlan.c
src/util/virnetdevopenvswitch.c
src/util/virnetdevtap.c
+src/util/virnetdevveth.c
src/util/virnetdevvportprofile.c
src/util/virnetlink.c
src/util/virnodesuspend.c
diff --git a/src/util/virnetdevveth.c b/src/util/virnetdevveth.c
index 7414a14..e6ccdd1 100644
--- a/src/util/virnetdevveth.c
+++ b/src/util/virnetdevveth.c
@@ -170,16 +170,15 @@ int virNetDevVethDelete(const char *veth)
rc = virRun(argv, &cmdResult);
- 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;
+ if (rc != 0)
+ return -1;
+
+ if (WIFEXITED(cmdResult) && WEXITSTATUS(cmdResult) != 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to delete '%s' (exit status %d)"),
+ veth, WEXITSTATUS(cmdResult));
+ return -1;
}
- return rc;
+ return 0;
}
--
1.7.11.2