sd-device: check whether filter is updated or not in sd_device_monitor_filter_update()
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user