From: Yu Watanabe Date: Sun, 25 Nov 2018 05:44:46 +0000 (+0900) Subject: sd-device: check whether filter is updated or not in sd_device_monitor_filter_update() X-Git-Tag: v240~218^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f1d7b7874ed6da76ccd8a29c9af9b20a33447fad;p=thirdparty%2Fsystemd.git sd-device: check whether filter is updated or not in sd_device_monitor_filter_update() --- diff --git a/src/libsystemd/sd-device/device-monitor.c b/src/libsystemd/sd-device/device-monitor.c index aaf4f3889b3..ff0fdbc93e3 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;