[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] Output commandline on status != 0 in virCommandWait



I pushed this one as suggested by Daniel in

https://www.redhat.com/archives/libvir-list/2011-February/msg00519.html

Matthias
From c7a6fc375a4fef01c0e47567bf44502c6f61842f Mon Sep 17 00:00:00 2001
From: Matthias Bolte <matthias bolte googlemail com>
Date: Tue, 15 Feb 2011 11:46:16 +0100
Subject: [PATCH] Output commandline on status != 0 in virCommandWait

This helps identifying which command exited with status != 0.
---
 src/util/command.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/util/command.c b/src/util/command.c
index abd2dc4..258dc13 100644
--- a/src/util/command.c
+++ b/src/util/command.c
@@ -1221,9 +1221,11 @@ virCommandWait(virCommandPtr cmd, int *exitstatus)
 
     if (exitstatus == NULL) {
         if (status != 0) {
+            char *str = virCommandToString(cmd);
             virCommandError(VIR_ERR_INTERNAL_ERROR,
-                            _("Child process exited with status %d."),
-                            WEXITSTATUS(status));
+                            _("Child process (%s) exited with status %d."),
+                            str ? str : cmd->args[0], WEXITSTATUS(status));
+            VIR_FREE(str);
             return -1;
         }
     } else {
-- 
1.7.0.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]