[libvirt] [PATCH] util: fix error messages in virNetlinkEventServiceStart

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

On 04/26/2012 01:09 PM, Laine Stump wrote:
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(-)
ACK. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 04/26/2012 03:14 PM, Eric Blake wrote:
On 04/26/2012 01:09 PM, Laine Stump wrote:
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(-) ACK.
Pushed, Thanks!
participants (2)
-
Eric Blake
-
Laine Stump