X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flogin%2Flogind-session.c;h=958b516701a9d95ea0890146ab0bc7e4aced8336;hb=5a165aa6b9aa921d8b069059026d84e879ac38cc;hp=77462a8d152bb64f10a7606edfae03380f10f859;hpb=877d54e9b09e093c2102f519a84e2a52637ae035;p=elogind.git diff --git a/src/login/logind-session.c b/src/login/logind-session.c index 77462a8d1..958b51670 100644 --- a/src/login/logind-session.c +++ b/src/login/logind-session.c @@ -526,7 +526,9 @@ static int session_create_cgroup(Session *s) { } } - hashmap_put(s->manager->session_cgroups, s->cgroup_path, s); + r = hashmap_put(s->manager->session_cgroups, s->cgroup_path, s); + if (r < 0) + log_warning("Failed to create mapping between cgroup and session"); return 0; } @@ -714,9 +716,11 @@ int session_stop(Session *s) { seat_set_active(s->seat, NULL); seat_send_changed(s->seat, "Sessions\0"); + seat_save(s->seat); } user_send_changed(s->user, "Sessions\0"); + user_save(s->user); s->started = false; @@ -736,7 +740,6 @@ int session_get_idle_hint(Session *s, dual_timestamp *t) { char *p; struct stat st; usec_t u, n; - bool b; int k; assert(s); @@ -771,12 +774,11 @@ int session_get_idle_hint(Session *s, dual_timestamp *t) { u = timespec_load(&st.st_atim); n = now(CLOCK_REALTIME); - b = u + IDLE_THRESHOLD_USEC < n; if (t) - dual_timestamp_from_realtime(t, u + b*IDLE_THRESHOLD_USEC); + dual_timestamp_from_realtime(t, u); - return b; + return u + IDLE_THRESHOLD_USEC < n; dont_know: if (t) @@ -870,6 +872,9 @@ void session_remove_fifo(Session *s) { assert_se(epoll_ctl(s->manager->epoll_fd, EPOLL_CTL_DEL, s->fifo_fd, NULL) == 0); close_nointr_nofail(s->fifo_fd); s->fifo_fd = -1; + + session_save(s); + user_save(s->user); } if (s->fifo_path) {