summaryrefslogtreecommitdiff
path: root/src/login/sd-login.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-09-12 08:30:35 +0200
committerLennart Poettering <lennart@poettering.net>2012-09-12 08:30:35 +0200
commitd18dff430bf60291a41b2c7dbe0ae5a5c4edf36c (patch)
treea3f72a4d63da42dc5ce32a422fef26f501ee8c74 /src/login/sd-login.c
parent78ab361c8f5f5d7614b5bf98b92f3aec4183bfb7 (diff)
login: reshuffle meaning of require_active parameter
Diffstat (limited to 'src/login/sd-login.c')
-rw-r--r--src/login/sd-login.c14
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) {