[systemd-devel] [PATCH] logind: use session_get_state() to get sessions state of the user

Djalal Harouni tixxdz at opendz.org
Sat Feb 8 13:20:53 PST 2014

On Sat, Feb 08, 2014 at 10:01:18PM +0100, Zbigniew Jędrzejewski-Szmek wrote:
> On Sat, Feb 08, 2014 at 08:51:57PM +0100, Djalal Harouni wrote:
> > In function user_get_state() remove the session_is_active() check, just
> > count on the session_get_state() function to get the correct session
> > state.
> > 
> > session_is_active() may return true before starting the session scope
> > and user service, this means it will return true even before the creation
> > of the session fifo_fd which will produce incorrect states.
> > 
> > So be consistent and just use session_get_state().
> Sooo... with your patch applied, I see: 
> sshd[18756]: pam_unix(sshd:session): session closed for user user2
> systemd-logind[18687]: Sent message type=method_call sender=n/a destination=org.freedesktop.systemd1 object=/org/freedesktop/systemd1/unit/session_2d10_2escope interface=org.freedesktop.systemd1.Scope member=Abandon cookie=27 reply_cookie=0 error=n/a
> And nothing afterwards. User manager for user2 is undisturbed.
Ah this patch fixes the user state.

The one you should apply is from the other thread:

It should work, please give it a try!

> Zbyszek

Djalal Harouni

More information about the systemd-devel mailing list