]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh: report errors in virshInit()
authorDaniel P. Berrange <berrange@redhat.com>
Wed, 19 Apr 2017 10:42:00 +0000 (11:42 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Wed, 19 Apr 2017 10:42:00 +0000 (11:42 +0100)
There are several functions in virshInit which can fail, especially
when running win32 builds under WINE. Currently virsh just exits
without reporting what error happened.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
tools/virsh.c

index 31e23bd27d1b26775b78de0e00f9a9aef972b1b3..90f812538cba0b8859fe688101c98f41a8d9e2c4 100644 (file)
@@ -358,16 +358,22 @@ virshInit(vshControl *ctl)
     /* set up the library error handler */
     virSetErrorFunc(NULL, vshErrorHandler);
 
-    if (virEventRegisterDefaultImpl() < 0)
+    if (virEventRegisterDefaultImpl() < 0) {
+        vshReportError(ctl);
         return false;
+    }
 
-    if (virThreadCreate(&ctl->eventLoop, true, vshEventLoop, ctl) < 0)
+    if (virThreadCreate(&ctl->eventLoop, true, vshEventLoop, ctl) < 0) {
+        vshReportError(ctl);
         return false;
+    }
     ctl->eventLoopStarted = true;
 
     if ((ctl->eventTimerId = virEventAddTimeout(-1, vshEventTimeout, ctl,
-                                                NULL)) < 0)
+                                                NULL)) < 0) {
+        vshReportError(ctl);
         return false;
+    }
 
     if (ctl->connname) {
         /* Connecting to a named connection must succeed, but we delay