summaryrefslogtreecommitdiffstats
path: root/src/libudev/libudev-monitor.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-08-28 06:06:02 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-09-11 05:45:21 +0200
commit50d2158901fcc7207be1a50643772a8ba229742c (patch)
tree9273174fae355ebe6e59d5ddc87876bb34d0e049 /src/libudev/libudev-monitor.c
parentdhcp: fix assertion starting DHCP client without MAC address (#10054) (diff)
downloadsystemd-50d2158901fcc7207be1a50643772a8ba229742c.tar.xz
systemd-50d2158901fcc7207be1a50643772a8ba229742c.zip
libudev-monitor: use safe_close() in udev_monitor_disconnect()
Diffstat (limited to 'src/libudev/libudev-monitor.c')
-rw-r--r--src/libudev/libudev-monitor.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/libudev/libudev-monitor.c b/src/libudev/libudev-monitor.c
index f0b5081392..fe4595930f 100644
--- a/src/libudev/libudev-monitor.c
+++ b/src/libudev/libudev-monitor.c
@@ -425,13 +425,11 @@ _public_ int udev_monitor_set_receive_buffer_size(struct udev_monitor *udev_moni
return 0;
}
-int udev_monitor_disconnect(struct udev_monitor *udev_monitor)
-{
- int err;
+int udev_monitor_disconnect(struct udev_monitor *udev_monitor) {
+ assert(udev_monitor);
- err = close(udev_monitor->sock);
- udev_monitor->sock = -1;
- return err < 0 ? -errno : 0;
+ udev_monitor->sock = safe_close(udev_monitor->sock);
+ return 0;
}
/**