[virt-tools-list] [virt-viewer 2/2] Don't use virGetLastErrorMessage()

Christophe Fergeau cfergeau at redhat.com
Thu Oct 30 16:26:50 UTC 2014


This was introduced in libvirt 1.0.6 but we only require libvirt 0.10.0
---
 src/virt-viewer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/virt-viewer.c b/src/virt-viewer.c
index cbedc9f..830a96e 100644
--- a/src/virt-viewer.c
+++ b/src/virt-viewer.c
@@ -576,9 +576,10 @@ choose_vm(char **vm_name, virConnectPtr conn, GError **error)
 
     dom = virDomainLookupByName(conn, *vm_name);
     if (dom == NULL) {
+        virErrorPtr err = virGetLastError();
         g_set_error_literal(error,
                             VIRT_VIEWER_ERROR, VIRT_VIEWER_ERROR_FAILED,
-                            virGetLastErrorMessage());
+                            err && err->message ? err->message : "unknown libvirt error");
     } else if (virDomainGetState(dom, &i, NULL, 0) < 0 || i != VIR_DOMAIN_RUNNING) {
         g_set_error(error,
                     VIRT_VIEWER_ERROR, VIRT_VIEWER_ERROR_FAILED,
-- 
2.1.0




More information about the virt-tools-list mailing list