diff mbox

[2/9] fdstream: Report error with virProcessTranslateStatus

Message ID 6dd39d0b06005ff277b3416871fcde3b1733a14e.1461609759.git.crobinso@redhat.com
State Accepted
Commit 6b173cf562aa9997416bdbe3b573eabb921ee71f
Headers show

Commit Message

Cole Robinson April 25, 2016, 6:46 p.m. UTC
Rather than poorly duplicate it
---
 src/fdstream.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

-- 
2.7.3

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

Patch

diff --git a/src/fdstream.c b/src/fdstream.c
index 681b90e..b0a46e9 100644
--- a/src/fdstream.c
+++ b/src/fdstream.c
@@ -43,6 +43,7 @@ 
 #include "configmake.h"
 #include "virstring.h"
 #include "virtime.h"
+#include "virprocess.h"
 
 #define VIR_FROM_THIS VIR_FROM_STREAMS
 
@@ -263,13 +264,12 @@  virFDStreamCloseCommand(struct virFDStreamData *fdst)
     if (status != 0) {
         if (buf[0] != '\0') {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s", buf);
-        } else if (WIFEXITED(status)) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("I/O helper exited with status %d"),
-                           WEXITSTATUS(status));
         } else {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("I/O helper exited abnormally"));
+            char *str = virProcessTranslateStatus(status);
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           _("I/O helper exited with %s"),
+                           NULLSTR(str));
+            VIR_FREE(str);
         }
         goto error;
     }