From f1d7b7874ed6da76ccd8a29c9af9b20a33447fad Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sun, 25 Nov 2018 14:44:46 +0900 Subject: [PATCH] sd-device: check whether filter is updated or not in sd_device_monitor_filter_update() --- src/libsystemd/sd-device/device-monitor.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/libsystemd/sd-device/device-monitor.c b/src/libsystemd/sd-device/device-monitor.c index aaf4f38..ff0fdbc 100644 --- a/src/libsystemd/sd-device/device-monitor.c +++ b/src/libsystemd/sd-device/device-monitor.c @@ -269,11 +269,9 @@ int device_monitor_enable_receiving(sd_device_monitor *m) { assert_return(m, -EINVAL); - if (!m->filter_uptodate) { - r = sd_device_monitor_filter_update(m); - if (r < 0) - return log_debug_errno(r, "sd-device-monitor: Failed to update filter: %m"); - } + r = sd_device_monitor_filter_update(m); + if (r < 0) + return log_debug_errno(r, "sd-device-monitor: Failed to update filter: %m"); if (!m->bound) { if (bind(m->sock, &m->snl.sa, sizeof(struct sockaddr_nl)) < 0) @@ -595,6 +593,9 @@ _public_ int sd_device_monitor_filter_update(sd_device_monitor *m) { assert_return(m, -EINVAL); + if (m->filter_uptodate) + return 0; + if (hashmap_isempty(m->subsystem_filter) && set_isempty(m->tag_filter)) { m->filter_uptodate = true; -- 2.7.4