From: Lennart Poettering Date: Tue, 24 May 2011 22:58:55 +0000 (+0200) Subject: logind: unlink state files when stopping X-Git-Tag: v30~179 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d2f92cdfd0189491387069da45734816effd8cbd;p=systemd logind: unlink state files when stopping --- diff --git a/src/logind-seat.c b/src/logind-seat.c index 24a5d8f2..ae89ec9d 100644 --- a/src/logind-seat.c +++ b/src/logind-seat.c @@ -75,11 +75,7 @@ void seat_free(Seat *s) { hashmap_remove(s->manager->seats, s->id); - if (s->state_file) { - unlink(s->state_file); - free(s->state_file); - } - + free(s->state_file); free(s); } @@ -323,7 +319,7 @@ int seat_stop(Seat *s) { r = k; } - seat_save(s); + unlink(s->state_file); seat_add_to_gc_queue(s); return r; diff --git a/src/logind-session.c b/src/logind-session.c index 566323d1..8f1280db 100644 --- a/src/logind-session.c +++ b/src/logind-session.c @@ -86,11 +86,7 @@ void session_free(Session *s) { hashmap_remove(s->manager->sessions, s->id); - if (s->state_file) { - unlink(s->state_file); - free(s->state_file); - } - + free(s->state_file); free(s); } @@ -445,7 +441,8 @@ int session_stop(Session *s) { /* Remove X11 symlink */ session_unlink_x11_socket(s); - session_save(s); + unlink(s->state_file); + session_add_to_gc_queue(s); return r; } diff --git a/src/logind-user.c b/src/logind-user.c index 19db746d..7d6df8db 100644 --- a/src/logind-user.c +++ b/src/logind-user.c @@ -82,12 +82,7 @@ void user_free(User *u) { hashmap_remove(u->manager->users, ULONG_TO_PTR((unsigned long) u->uid)); free(u->name); - - if (u->state_file) { - unlink(u->state_file); - free(u->state_file); - } - + free(u->state_file); free(u); } @@ -385,6 +380,9 @@ int user_stop(User *u) { if (k < 0) r = k; + unlink(u->state_file); + user_add_to_gc_queue(u); + return r; } diff --git a/src/logind.h b/src/logind.h index 7a312162..a8b387b0 100644 --- a/src/logind.h +++ b/src/logind.h @@ -39,6 +39,7 @@ * PAM rewrite * spawn user systemd * dbus API + * don't allow everybody to take logind name * * non-local X11 server * reboot/shutdown halt management