diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/login/sd-login.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/login/sd-login.c b/src/login/sd-login.c index 88dd510870..82fe2ce3e3 100644 --- a/src/login/sd-login.c +++ b/src/login/sd-login.c @@ -259,11 +259,21 @@ static int uid_get_array(uid_t uid, const char *variable, char ***array) { } _public_ int sd_uid_get_sessions(uid_t uid, int require_active, char ***sessions) { - return uid_get_array(uid, require_active == 2 ? "ONLINE_SESSIONS" : (require_active ? "ACTIVE_SESSIONS" : "SESSIONS"), sessions); + return uid_get_array( + uid, + require_active == 0 ? "ONLINE_SESSIONS" : + require_active > 0 ? "ACTIVE_SESSIONS" : + "SESSIONS", + sessions); } _public_ int sd_uid_get_seats(uid_t uid, int require_active, char ***seats) { - return uid_get_array(uid, require_active == 2 ? "ONLINE_SEATS" : (require_active ? "ACTIVE_SEATS" : "SEATS"), seats); + return uid_get_array( + uid, + require_active == 0 ? "ONLINE_SEATS" : + require_active > 0 ? "ACTIVE_SEATS" : + "SEATS", + seats); } static int file_of_session(const char *session, char **_p) { |