From 78e9bb837c258ac0ec7712b3d612cc2f407e731e Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 05:50:42 +0200 Subject: Merging upstream version 256. Signed-off-by: Daniel Baumann --- src/login/logind-seat.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/login/logind-seat.c') diff --git a/src/login/logind-seat.c b/src/login/logind-seat.c index 8d875d2..bed1f7d 100644 --- a/src/login/logind-seat.c +++ b/src/login/logind-seat.c @@ -25,13 +25,13 @@ #include "terminal-util.h" #include "tmpfile-util.h" -int seat_new(Seat** ret, Manager *m, const char *id) { +int seat_new(Manager *m, const char *id, Seat **ret) { _cleanup_(seat_freep) Seat *s = NULL; int r; - assert(ret); assert(m); assert(id); + assert(ret); if (!seat_name_is_valid(id)) return -EINVAL; @@ -42,14 +42,12 @@ int seat_new(Seat** ret, Manager *m, const char *id) { *s = (Seat) { .manager = m, + .id = strdup(id), + .state_file = path_join("/run/systemd/seats/", id), }; - - s->state_file = path_join("/run/systemd/seats", id); - if (!s->state_file) + if (!s->id || !s->state_file) return -ENOMEM; - s->id = basename(s->state_file); - r = hashmap_put(m->seats, s->id, s); if (r < 0) return r; @@ -77,6 +75,7 @@ Seat* seat_free(Seat *s) { free(s->positions); free(s->state_file); + free(s->id); return mfree(s); } -- cgit v1.2.3