diff options
author | Giovanni Campagna <gcampagn@redhat.com> | 2013-09-11 18:48:20 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-09-11 19:08:20 +0200 |
commit | 44ded3abc28620279633f51a05f2416e5aa3e8e2 (patch) | |
tree | de6c3f0873348fcdb869f78deeb5bcd6957f6b83 /src/login/sd-login.c | |
parent | 4c3a31668e4f3be9a35177a35d5b9794cdff663e (diff) |
sd-login: add a public accessor for the VT number
The VT number was already part of the DBus API, but was not
exposed in the C API.
Diffstat (limited to 'src/login/sd-login.c')
-rw-r--r-- | src/login/sd-login.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/login/sd-login.c b/src/login/sd-login.c index 06587921cd..8a7838d566 100644 --- a/src/login/sd-login.c +++ b/src/login/sd-login.c @@ -347,6 +347,23 @@ _public_ int sd_session_get_tty(const char *session, char **tty) { return session_get_string(session, "TTY", tty); } +_public_ int sd_session_get_vt(const char *session, unsigned *vtnr) { + _cleanup_free_ char *vtnr_string; + unsigned u; + int r; + + r = session_get_string(session, "VTNr", &vtnr_string); + if (r < 0) + return r; + + r = safe_atou(vtnr_string, &u); + if (r < 0) + return r; + + *vtnr = u; + return 0; +} + _public_ int sd_session_get_service(const char *session, char **service) { return session_get_string(session, "SERVICE", service); } |