[libvirt] [PATCH] tests: virtnettlscontexttest: Use virGetLastErrorMessage()

Cole Robinson crobinso at redhat.com
Fri Mar 18 20:58:02 UTC 2016


Use virGetLastErrorMessage() rather than open code it
---
There's many more examples of this spread around the code; this patch
is meant as an example for http://wiki.libvirt.org/page/BiteSizedTasks

 tests/virnettlscontexttest.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tests/virnettlscontexttest.c b/tests/virnettlscontexttest.c
index a3e24a3..d33b896 100644
--- a/tests/virnettlscontexttest.c
+++ b/tests/virnettlscontexttest.c
@@ -90,13 +90,12 @@ static int testTLSContextInit(const void *opaque)
             goto cleanup;
         }
     } else {
-        virErrorPtr err = virGetLastError();
         if (!data->expectFail) {
             VIR_WARN("Unexpected failure %s against %s",
                      data->cacrt, data->crt);
             goto cleanup;
         }
-        VIR_DEBUG("Got error %s", err ? err->message : "<unknown>");
+        VIR_DEBUG("Got error %s", virGetLastErrorMessage());
     }
 
     ret = 0;
-- 
2.5.0




More information about the libvir-list mailing list