From f3f6ae7c983865ea37e8ddfbd676586e55280f1e Mon Sep 17 00:00:00 2001 From: Sven Eden Date: Wed, 26 Jul 2017 10:26:15 +0200 Subject: Prep v234: Re-add user/session to the gc_queue when stopping. If manager_gc() does not find the user/session, their respective finalize_*() method is never called, leaving stale state files in /run/systemd/sessions and run/systemd/users. --- src/login/logind-session.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'src/login/logind-session.c') diff --git a/src/login/logind-session.c b/src/login/logind-session.c index 28784a867..10e9327c0 100644 --- a/src/login/logind-session.c +++ b/src/login/logind-session.c @@ -768,6 +768,10 @@ int session_stop(Session *s, bool force) { session_save(s); user_save(s->user); +#if 1 /// elogind must queue this session again + session_add_to_gc_queue(s); +#endif // 1 + return r; } @@ -819,7 +823,6 @@ int session_finalize(Session *s) { return 0; } -#if 0 /// UNNEEDED by elogind static int release_timeout_callback(sd_event_source *es, uint64_t usec, void *userdata) { Session *s = userdata; @@ -829,7 +832,6 @@ static int release_timeout_callback(sd_event_source *es, uint64_t usec, void *us session_stop(s, false); return 0; } -#endif // 0 int session_release(Session *s) { assert(s); @@ -840,18 +842,11 @@ int session_release(Session *s) { if (s->timer_event_source) return 0; -#if 0 /// UNNEEDED by elogind return sd_event_add_time(s->manager->event, &s->timer_event_source, CLOCK_MONOTONIC, now(CLOCK_MONOTONIC) + RELEASE_USEC, 0, release_timeout_callback, s); -#else - /* In systemd, session release is triggered by user jobs - dying. In elogind we don't have that so go ahead and stop - now. */ - return session_stop(s, false); -#endif // 0 } bool session_is_active(Session *s) { -- cgit v1.2.3