device-util: introduce device_get_seat() helper function

This commit is contained in:
Yu Watanabe
2025-05-14 02:06:02 +09:00
parent ab1bd9daed
commit 2012d6d74e
8 changed files with 44 additions and 18 deletions
+3 -2
View File
@@ -32,8 +32,9 @@ static int builtin_uaccess(UdevEvent *event, int argc, char *argv[]) {
return log_device_error_errno(dev, r, "Failed to get device node: %m");
const char *seat;
if (sd_device_get_property_value(dev, "ID_SEAT", &seat) < 0)
seat = "seat0";
r = device_get_seat(dev, &seat);
if (r < 0)
return log_device_error_errno(dev, r, "Failed to get seat: %m");
uid_t uid;
r = sd_seat_get_active(seat, /* ret_session = */ NULL, &uid);