summaryrefslogtreecommitdiff
path: root/src/login/logind-user.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-05-31 19:46:42 +0200
committerLennart Poettering <lennart@poettering.net>2012-05-31 19:46:42 +0200
commit8c8c43515cee56dfc2298998a9e5958308c46f99 (patch)
tree3d7f891b8478df86683058b9a0e160c69b5c6c8b /src/login/logind-user.c
parent952d817a41dfe207d159f8278f4d7f1f7654c572 (diff)
logind: properly clean up user cgroups when they run empty
Diffstat (limited to 'src/login/logind-user.c')
-rw-r--r--src/login/logind-user.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/login/logind-user.c b/src/login/logind-user.c
index b971845e14..8bd773086e 100644
--- a/src/login/logind-user.c
+++ b/src/login/logind-user.c
@@ -75,6 +75,8 @@ void user_free(User *u) {
while (u->sessions)
session_free(u->sessions);
+ if (u->cgroup_path)
+ hashmap_remove(u->manager->user_cgroups, u->cgroup_path);
free(u->cgroup_path);
free(u->service);
@@ -313,6 +315,8 @@ static int user_create_cgroup(User *u) {
log_warning("Failed to create cgroup %s:%s: %s", *k, p, strerror(-r));
}
+ hashmap_put(u->manager->user_cgroups, u->cgroup_path, u);
+
return 0;
}
@@ -417,6 +421,8 @@ static int user_terminate_cgroup(User *u) {
STRV_FOREACH(k, u->manager->controllers)
cg_trim(*k, u->cgroup_path, true);
+ hashmap_remove(u->manager->user_cgroups, u->cgroup_path);
+
free(u->cgroup_path);
u->cgroup_path = NULL;