On Thu, Jul 27, 2017 at 01:47:22PM +0200, Michal Privoznik wrote:
The virMutexInit() function is not reporting any error on failure
rather than returning -1 and setting errno. It's up to the caller
to report the error.
I would rather see virMutexInit() report the error since it looks like
some code already counts on it (I haven't done any comparison) and
different error messages for each mutex does not really help anything
IMHO since mutex initialization is fatal anyway.
I think virthread.c does not report errors because we had multiple
implementations for it, but that's no longer true since 404174cad321
(late 2012).
diff --git a/tools/virsh-console.c b/tools/virsh-console.c
index c1927c28a..ab3339ec7 100644
--- a/tools/virsh-console.c
+++ b/tools/virsh-console.c
@@ -351,8 +351,10 @@ virshRunConsole(vshControl *ctl,
if (virDomainOpenConsole(dom, dev_name, con->st, flags) < 0)
goto cleanup;
- if (virCondInit(&con->cond) < 0 || virMutexInit(&con->lock) < 0)
+ if (virCondInit(&con->cond) < 0 || virMutexInit(&con->lock) < 0)
{
+ VIR_ERROR(_("unable to init console lock or condition"));
I don't see a reason for VIR_ERROR here. Also virCondInit() and other
could report error, although that's not the aim of this patch.
goto cleanup;
+ }
virMutexLock(&con->lock);
--
2.13.0
--
libvir-list mailing list
libvir-list(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list