When initializing a mutex (either regular or RW) the virMutexInit() and
virRWLockInit() functions set errno and return -1. It's a pity we don't
use virReportSystemError() in that case rather plain virReportError().

Signed-off-by: Michal Privoznik <mpriv...@redhat.com>
---
 src/util/virobject.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/util/virobject.c b/src/util/virobject.c
index 1723df6b2..b2fc63aec 100644
--- a/src/util/virobject.c
+++ b/src/util/virobject.c
@@ -273,8 +273,8 @@ virObjectLockableNew(virClassPtr klass)
         return NULL;
 
     if (virMutexInit(&obj->lock) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("Unable to initialize mutex"));
+        virReportSystemError(errno, "%s",
+                             _("Unable to initialize mutex"));
         virObjectUnref(obj);
         return NULL;
     }
@@ -299,8 +299,8 @@ virObjectRWLockableNew(virClassPtr klass)
         return NULL;
 
     if (virRWLockInit(&obj->lock) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("Unable to initialize RW lock"));
+        virReportSystemError(errno, "%s",
+                             _("Unable to initialize RW lock"));
         virObjectUnref(obj);
         return NULL;
     }
-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to