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).
This commit is contained in:
Laine Stump 2012-04-26 14:35:26 -04:00
parent 8ef5f26361
commit 9586925bac

View File

@ -238,7 +238,7 @@ virNetlinkEventCallback(int watch,
if (length == 0)
return;
if (length < 0) {
netlinkError(errno,
virReportSystemError(errno,
"%s", _("nl_recv returned with error"));
return;
}
@ -349,13 +349,13 @@ virNetlinkEventServiceStart(void)
srv->netlinknh = nl_handle_alloc();
if (!srv->netlinknh) {
netlinkError(errno,
virReportSystemError(errno,
"%s", _("cannot allocate nlhandle for virNetlinkEvent server"));
goto error_locked;
}
if (nl_connect(srv->netlinknh, NETLINK_ROUTE) < 0) {
netlinkError(errno,
virReportSystemError(errno,
"%s", _("cannot connect to netlink socket"));
goto error_server;
}
@ -363,13 +363,13 @@ virNetlinkEventServiceStart(void)
fd = nl_socket_get_fd(srv->netlinknh);
if (fd < 0) {
netlinkError(errno,
virReportSystemError(errno,
"%s", _("cannot get netlink socket fd"));
goto error_server;
}
if (nl_socket_set_nonblocking(srv->netlinknh)) {
netlinkError(errno, "%s",
virReportSystemError(errno, "%s",
_("cannot set netlink socket nonblocking"));
goto error_server;
}