[libvirt] [PATCH 1/3] virterror: Make SetError work if no previous error was set

Cole Robinson crobinso at redhat.com
Tue Feb 16 19:37:00 UTC 2010


virGetLastError returns NULL if no error has been set, not on
allocation error like virSetError assumed. Use virLastErrorObject
instead. This fixes virSetError when no error is currently stored.

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

diff --git a/src/util/virterror.c b/src/util/virterror.c
index bbf5021..cbd0ca8 100644
--- a/src/util/virterror.c
+++ b/src/util/virterror.c
@@ -304,7 +304,7 @@ int
 virSetError(virErrorPtr newerr)
 {
     virErrorPtr err;
-    err = virGetLastError();
+    err = virLastErrorObject();
     if (!err)
         return -1;
 
-- 
1.6.5.2




More information about the libvir-list mailing list