]> xenbits.xensource.com Git - libvirt.git/commitdiff
fdstream: Report error with virProcessTranslateStatus
authorCole Robinson <crobinso@redhat.com>
Mon, 25 Apr 2016 16:34:14 +0000 (12:34 -0400)
committerCole Robinson <crobinso@redhat.com>
Mon, 2 May 2016 14:13:04 +0000 (10:13 -0400)
Rather than poorly duplicate it

src/fdstream.c

index 69d17b42f0a4ac8fc8b02aa5c6b356522f81571c..8e5fa2fd0ebaff9142a500a6b75628a943c8974a 100644 (file)
@@ -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 cleanup;
     }