[libvirt] [PATCH] util: Make sure virExec hook failures are raised

Cole Robinson crobinso at redhat.com
Wed Jan 13 20:50:07 UTC 2010


With the introduction virDispatchError, hook function errors are
never sent through the error callback, so users will never see
these messages.

Fix this by calling virDispatchError after hook failure.

Signed-off-by: Cole Robinson <crobinso at redhat.com>
---
 src/util/util.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/util/util.c b/src/util/util.c
index ba6b0db..45ca657 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -557,8 +557,11 @@ __virExec(virConnectPtr conn,
     }
 
     if (hook)
-        if ((hook)(data) != 0)
+        if ((hook)(data) != 0) {
+            VIR_DEBUG0("Hook function failed.");
+            virDispatchError(NULL);
             _exit(1);
+        }
 
     /* The steps above may need todo something privileged, so
      * we delay clearing capabilities until the last minute */
-- 
1.6.5.2




More information about the libvir-list mailing list