diff options
author | Tom Gundersen <teg@jklm.no> | 2015-03-11 22:23:38 +0100 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2015-03-12 12:03:50 +0100 |
commit | a4445e88cece0444c66d70876b03065158dd4685 (patch) | |
tree | c13565dd027703edcb6e88b05838c306399fdeb4 /src/libudev | |
parent | 3c0bab4aaf70b2383aa4cbabf6059c48744e8960 (diff) |
libudev: monitor - fix error path in send_device
Return -errno rather than -1 in case sendmsg() fails.
Diffstat (limited to 'src/libudev')
-rw-r--r-- | src/libudev/libudev-monitor.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/libudev/libudev-monitor.c b/src/libudev/libudev-monitor.c index eb7b6f87b2..0c554bbac4 100644 --- a/src/libudev/libudev-monitor.c +++ b/src/libudev/libudev-monitor.c @@ -745,12 +745,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; } |