From 1713813de365486617ab87899f950e9b6ec928ef Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 24 Jun 2011 20:41:56 +0200 Subject: logind: remove a session when its cgroup is gone --- src/logind-session.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/logind-session.c') diff --git a/src/logind-session.c b/src/logind-session.c index 74f8ad1b0c..9278f30754 100644 --- a/src/logind-session.c +++ b/src/logind-session.c @@ -83,6 +83,9 @@ void session_free(Session *s) { LIST_REMOVE(Session, sessions_by_seat, s->seat->sessions, s); } + if (s->cgroup_path) + hashmap_remove(s->manager->cgroups, s->cgroup_path); + free(s->cgroup_path); strv_free(s->controllers); @@ -468,6 +471,8 @@ static int session_create_cgroup(Session *s) { } } + hashmap_put(s->manager->cgroups, s->cgroup_path, s); + return 0; } @@ -562,6 +567,8 @@ static int session_kill_cgroup(Session *s) { STRV_FOREACH(k, s->user->manager->controllers) cg_trim(*k, s->cgroup_path, true); + hashmap_remove(s->manager->cgroups, s->cgroup_path); + free(s->cgroup_path); s->cgroup_path = NULL; -- cgit v1.2.3-54-g00ecf