summaryrefslogtreecommitdiffstats
path: root/src/login/logind-seat.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/login/logind-seat.c')
-rw-r--r--src/login/logind-seat.c13
1 files changed, 6 insertions, 7 deletions
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);
}