From d18dff430bf60291a41b2c7dbe0ae5a5c4edf36c Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 12 Sep 2012 08:30:35 +0200 Subject: login: reshuffle meaning of require_active parameter --- src/login/sd-login.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src') 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) { -- cgit v1.2.3-54-g00ecf