From: Daniel P. Berrange Date: Wed, 19 Apr 2017 10:42:00 +0000 (+0100) Subject: virsh: report errors in virshInit() X-Git-Tag: v3.3.0-rc1~133 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b8c17203e33a5d8cc06d2f217c3f14aa428a73b;p=thirdparty%2Flibvirt.git virsh: report errors in virshInit() 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 --- diff --git a/tools/virsh.c b/tools/virsh.c index 31e23bd27d..90f812538c 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -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