diff mbox

tests: virtnettlscontexttest: Use virGetLastErrorMessage()

Message ID 141c027b8dec6c57c9952b4fa3ae2305f9beb81d.1458334555.git.crobinso@redhat.com
State Accepted
Commit 4902231777b5160e16ef159882558439b06875b9
Headers show

Commit Message

Cole Robinson March 18, 2016, 8:58 p.m. UTC
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(-)

-- 
2.5.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
diff mbox

Patch

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;