diff options
author | Lennart Poettering <lennart@poettering.net> | 2011-07-26 23:09:09 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2011-07-26 23:09:09 +0200 |
commit | add30678a1bf284ecd79438d219c45ca7a1c9f51 (patch) | |
tree | 9982db1d6503146e4e782264b5063ddb2d0060a8 /src/sd-login.c | |
parent | 64559e8b4e81897bab3659aea27791467a579566 (diff) |
sd-login: add new call sd_seat_can_multi_session()
Diffstat (limited to 'src/sd-login.c')
-rw-r--r-- | src/sd-login.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/sd-login.c b/src/sd-login.c index 2c5b153fba..d44a1fcf9c 100644 --- a/src/sd-login.c +++ b/src/sd-login.c @@ -522,6 +522,36 @@ _public_ int sd_seat_get_sessions(const char *seat, char ***sessions, uid_t **ui return 0; } +_public_ int sd_seat_can_multi_session(const char *seat) { + char *p, *s = NULL; + int r; + + if (!seat) + return -EINVAL; + + p = strappend("/run/systemd/seats/", seat); + if (!p) + return -ENOMEM; + + r = parse_env_file(p, NEWLINE, + "IS_VTCONSOLE", &s, + NULL); + free(p); + + if (r < 0) { + free(s); + return r; + } + + if (s) { + r = parse_boolean(s); + free(s); + } else + r = 0; + + return r; +} + _public_ int sd_get_seats(char ***seats) { if (!seats) |