X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fsd-login.c;h=d44a1fcf9c473487f5e48355f2681659a3305de1;hb=288088b86c29d0e3074c425eaf4307f89deee11c;hp=b7ae870af4d7577882a88441ac2412aeb9c10557;hpb=ddd88763921a1534081ed28e36f6712a85449005;p=elogind.git diff --git a/src/sd-login.c b/src/sd-login.c index b7ae870af..d44a1fcf9 100644 --- a/src/sd-login.c +++ b/src/sd-login.c @@ -327,7 +327,6 @@ _public_ int sd_session_is_active(const char *session) { _public_ int sd_session_get_uid(const char *session, uid_t *uid) { int r; char *p, *s = NULL; - unsigned long ul; if (!session) return -EINVAL; @@ -523,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) @@ -610,7 +639,6 @@ static inline sd_login_monitor* FD_TO_MONITOR(int fd) { } _public_ int sd_login_monitor_new(const char *category, sd_login_monitor **m) { - const char *path; int fd, k; bool good = false;