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

[libvirt] [PATCH] virterror: Don't invoke error callback for ERR_OK



Since virDispatchError is now responsible for invoking the error callback,
give it the same semantics as ReportError, which will skip VIR_ERR_OK
(which is encountered when no error was raised).

This fixes invoking the error callback after every non-erroring API call.

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

diff --git a/src/util/virterror.c b/src/util/virterror.c
index e2128b9..78974ee 100644
--- a/src/util/virterror.c
+++ b/src/util/virterror.c
@@ -603,8 +603,12 @@ virDispatchError(virConnectPtr conn)
     if (!err)
         return;
 
-    /* Set a generic error message if none is already set */
+    /* We never used to raise ERR_OK, so maintain existing behavior */
     if (err->code == VIR_ERR_OK)
+        return;
+
+    /* Set a generic error message if none is already set */
+    if (!err->message)
         virErrorGenericFailure(err);
 
     /* Copy the global error to per-connection error if needed */
-- 
1.6.5.2


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