[PATCH 1/6] virObject: use virReportSystemError if applicable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <mprivozn@xxxxxxxxxx>
---
 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@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux