-gboolean avahi_netlink_work(AvahiNetlink *nl, gboolean block) {
- g_assert(nl);
-
- for (;;) {
- guint8 replybuf[64*1024];
- ssize_t bytes;
- struct nlmsghdr *p = (struct nlmsghdr *) replybuf;
-
- if ((bytes = recv(nl->fd, replybuf, sizeof(replybuf), block ? 0 : MSG_DONTWAIT)) < 0) {
-
- if (errno == EAGAIN || errno == EINTR)
- break;
-
- g_warning("NETLINK: recv() failed");
- return FALSE;
- }
-
- if (nl->callback) {
- for (; bytes > 0; p = NLMSG_NEXT(p, bytes)) {
- if (!NLMSG_OK(p, (size_t) bytes)) {
- g_warning("NETLINK: packet truncated");
- return FALSE;
- }
+int avahi_netlink_work(AvahiNetlink *nl, int block) {
+ ssize_t bytes;
+ struct nlmsghdr *p;
+
+ assert(nl);
+
+ if ((bytes = recv(nl->fd, nl->buffer, nl->buffer_length, block ? 0 : MSG_DONTWAIT)) < 0) {
+
+ if (errno == EAGAIN || errno == EINTR)
+ return 0;
+
+ avahi_log_error(__FILE__": recv() failed: %s", strerror(errno));
+ return -1;
+ }