summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-03-11 22:23:38 +0100
committerAnthony G. Basile <blueness@gentoo.org>2015-03-18 20:40:02 -0400
commite5df4c6a5255272ee5d9edb24e2da49bfae17c09 (patch)
tree22adfde891813ba34bacf48bbf9bd6e9e230a5f3 /src
parent93d2bf9fcb24d69db27084483c5181722bcc2df8 (diff)
libudev: monitor - fix error path in send_device
Return -errno rather than -1 in case sendmsg() fails. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src')
-rw-r--r--src/libudev/libudev-monitor.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/libudev/libudev-monitor.c b/src/libudev/libudev-monitor.c
index 3f1fee7f7e..d0486e3d1e 100644
--- a/src/libudev/libudev-monitor.c
+++ b/src/libudev/libudev-monitor.c
@@ -749,12 +749,20 @@ int udev_monitor_send_device(struct udev_monitor *udev_monitor,
* If we send to a multicast group, we will get
* ECONNREFUSED, which is expected.
*/
- if (destination != NULL)
+ if (destination)
smsg.msg_name = &destination->snl;
else
smsg.msg_name = &udev_monitor->snl_destination;
smsg.msg_namelen = sizeof(struct sockaddr_nl);
count = sendmsg(udev_monitor->sock, &smsg, 0);
+ if (count < 0) {
+ if (!destination && errno == ECONNREFUSED) {
+ log_debug("passed unknown number of bytes to netlink monitor %p", udev_monitor);
+ return 0;
+ } else
+ return -errno;
+ }
+
log_debug("passed %zi bytes to netlink monitor %p", count, udev_monitor);
return count;
}