[PATCH] util: fix error messages in virNetlinkEventServiceStart

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

 



Some of the error messages in this function should have been
virReportSystemError (since they have an errno they want to log), but
were mistakenly written as netlinkError, which expects a libvirt error
code instead. The result was that when one of the errors was
encountered, "No error message provided" would be printed instead of
something meaningful (see
https://bugzilla.redhat.com/show_bug.cgi?id=816465 for an example).
---
 src/util/virnetlink.c |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/util/virnetlink.c b/src/util/virnetlink.c
index 7017275..b2e9d51 100644
--- a/src/util/virnetlink.c
+++ b/src/util/virnetlink.c
@@ -238,8 +238,8 @@ virNetlinkEventCallback(int watch,
     if (length == 0)
         return;
     if (length < 0) {
-        netlinkError(errno,
-                     "%s", _("nl_recv returned with error"));
+        virReportSystemError(errno,
+                             "%s", _("nl_recv returned with error"));
         return;
     }
 
@@ -349,28 +349,28 @@ virNetlinkEventServiceStart(void)
     srv->netlinknh = nl_handle_alloc();
 
     if (!srv->netlinknh) {
-        netlinkError(errno,
-                "%s", _("cannot allocate nlhandle for virNetlinkEvent server"));
+        virReportSystemError(errno,
+                             "%s", _("cannot allocate nlhandle for virNetlinkEvent server"));
         goto error_locked;
     }
 
     if (nl_connect(srv->netlinknh, NETLINK_ROUTE) < 0) {
-        netlinkError(errno,
-                "%s", _("cannot connect to netlink socket"));
+        virReportSystemError(errno,
+                             "%s", _("cannot connect to netlink socket"));
         goto error_server;
     }
 
     fd = nl_socket_get_fd(srv->netlinknh);
 
     if (fd < 0) {
-        netlinkError(errno,
-                     "%s", _("cannot get netlink socket fd"));
+        virReportSystemError(errno,
+                             "%s", _("cannot get netlink socket fd"));
         goto error_server;
     }
 
     if (nl_socket_set_nonblocking(srv->netlinknh)) {
-        netlinkError(errno, "%s",
-                     _("cannot set netlink socket nonblocking"));
+        virReportSystemError(errno, "%s",
+                             _("cannot set netlink socket nonblocking"));
         goto error_server;
     }
 
-- 
1.7.10

--
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]