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