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

[libvirt] [PATCH 3/3] libvirt-qemu: Dispatch errors from virDomainQemuAgentCommand()



The original implementation didn't follow the established pattern and
did not dispatch errors in case of failure.
---
 src/libvirt-qemu.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/libvirt-qemu.c b/src/libvirt-qemu.c
index 747488d..e884e32 100644
--- a/src/libvirt-qemu.c
+++ b/src/libvirt-qemu.c
@@ -211,6 +211,7 @@ virDomainQemuAgentCommand(virDomainPtr domain,
                           unsigned int flags)
 {
     virConnectPtr conn;
+    char *ret;

     VIR_DEBUG("domain=%p, cmd=%s, timeout=%d, flags=%x",
               domain, cmd, timeout, flags);
@@ -228,13 +229,17 @@ virDomainQemuAgentCommand(virDomainPtr domain,
     conn = domain->conn;

     if (conn->driver->domainQemuAgentCommand) {
-        return conn->driver->domainQemuAgentCommand(domain, cmd,
-                                                    timeout, flags);
+        ret = conn->driver->domainQemuAgentCommand(domain, cmd,
+                                                   timeout, flags);
+        if (!ret)
+            goto error;
+        return ret;
     }

     virLibConnError(conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);

     /* Copy to connection error object for back compatibility */
+error:
     virDispatchError(conn);
     return NULL;
 }
-- 
1.8.2.1


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