X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;ds=sidebyside;f=avahi-core%2Fnetlink.c;h=d5d22951aac2e7b0db3fb00fe6b301f99bab3de6;hb=d322a943be5387a539f8f3ea3a19a7e2ed5a55a2;hp=92d614fc8df7bea8941a74bccf415d515f5b9dde;hpb=4f0a5e7572a4257894b4bfede42c26d65152609e;p=catta diff --git a/avahi-core/netlink.c b/avahi-core/netlink.c index 92d614f..d5d2295 100644 --- a/avahi-core/netlink.c +++ b/avahi-core/netlink.c @@ -41,7 +41,7 @@ struct AvahiNetlink { uint8_t* buffer; size_t buffer_length; - AvahiPoll *poll_api; + const AvahiPoll *poll_api; AvahiWatch *watch; }; @@ -56,10 +56,10 @@ int avahi_netlink_work(AvahiNetlink *nl, int block) { if ((bytes = recv(nl->fd, nl->buffer, nl->buffer_length, block ? 0 : MSG_DONTWAIT)) < 0) { if (errno == EAGAIN || errno == EINTR) - return 1; + return 0; avahi_log_error(__FILE__": recv() failed: %s", strerror(errno)); - return 0; + return -1; } break; @@ -71,7 +71,7 @@ int avahi_netlink_work(AvahiNetlink *nl, int block) { for (; bytes > 0; p = NLMSG_NEXT(p, bytes)) { if (!NLMSG_OK(p, (size_t) bytes)) { avahi_log_warn(__FILE__": packet truncated"); - return 0; + return -1; } nl->callback(nl, p, nl->userdata); @@ -93,7 +93,7 @@ static void socket_event(AvahiWatch *w, int fd, AvahiWatchEvent event, void *use avahi_netlink_work(nl, 0); } -AvahiNetlink *avahi_netlink_new(AvahiPoll *poll_api, uint32_t groups, void (*cb) (AvahiNetlink *nl, struct nlmsghdr *n, void* userdata), void* userdata) { +AvahiNetlink *avahi_netlink_new(const AvahiPoll *poll_api, uint32_t groups, void (*cb) (AvahiNetlink *nl, struct nlmsghdr *n, void* userdata), void* userdata) { int fd = -1; struct sockaddr_nl addr; AvahiNetlink *nl = NULL; @@ -175,7 +175,7 @@ int avahi_netlink_send(AvahiNetlink *nl, struct nlmsghdr *m, unsigned *ret_seq) m->nlmsg_flags |= NLM_F_ACK; if (send(nl->fd, m, m->nlmsg_len, 0) < 0) { - avahi_log_error(__FILE__": send(): %s\n", strerror(errno)); + avahi_log_error(__FILE__": send(): %s", strerror(errno)); return -1; }