login: do not call manager_process_seat_device() more than once per event

When udevd broadcasts an event for e.g. a graphics device with master-of-seat
tag, then previously manager_process_seat_device() was called twice for
the event.

With this commit, the function is called only once even for an event for
such device.
This commit is contained in:
Yu Watanabe
2025-05-13 23:50:22 +09:00
parent 3400abf3ca
commit 26a675dd56

View File

@@ -610,19 +610,35 @@ static int manager_enumerate_inhibitors(Manager *m) {
static int manager_dispatch_seat_udev(sd_device_monitor *monitor, sd_device *device, void *userdata) {
Manager *m = ASSERT_PTR(userdata);
int r;
assert(device);
manager_process_seat_device(m, device);
r = manager_process_seat_device(m, device);
if (r < 0)
log_device_warning_errno(device, r, "Failed to process seat device, ignoring: %m");
return 0;
}
static int manager_dispatch_device_udev(sd_device_monitor *monitor, sd_device *device, void *userdata) {
Manager *m = ASSERT_PTR(userdata);
int r;
assert(device);
manager_process_seat_device(m, device);
/* If the device currently has "master-of-seat" tag, then it has been or will be processed by
* manager_dispatch_seat_udev(). */
r = sd_device_has_current_tag(device, "master-of-seat");
if (r < 0)
log_device_warning_errno(device, r, "Failed to check if the device currently has master-of-seat tag, ignoring: %m");
if (r != 0)
return 0;
r = manager_process_seat_device(m, device);
if (r < 0)
log_device_warning_errno(device, r, "Failed to process seat device, ignoring: %m");
return 0;
}