diff options
author | Lennart Poettering <lennart@poettering.net> | 2019-04-28 18:02:03 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2019-05-24 15:05:27 +0200 |
commit | 544c4e1eda4b15beec8a9d7e3708b262b954e757 (patch) | |
tree | 23c2b7396368457d0c75f170b7013653088f0a97 | |
parent | 3b92c086a8d5338e2164ffa0ae48b3d03d10cfb5 (diff) | |
download | systemd-544c4e1eda4b15beec8a9d7e3708b262b954e757.tar.gz |
loginctl: drop $XDG_SESSION_ID env var magic
The server side can do something similar, but better on its own, let's
hence rely on that.
-rw-r--r-- | src/login/loginctl.c | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/src/login/loginctl.c b/src/login/loginctl.c index 687a534f7b..2ad9887066 100644 --- a/src/login/loginctl.c +++ b/src/login/loginctl.c @@ -846,23 +846,11 @@ static int show_session(int argc, char *argv[], void *userdata) { (void) pager_open(arg_pager_flags); if (argc <= 1) { - const char *session, *p = "/org/freedesktop/login1/session/self"; - + /* If no argument is specified inspect the manager itself */ if (properties) - /* If no argument is specified inspect the manager itself */ return show_properties(bus, "/org/freedesktop/login1", &new_line); - /* And in the pretty case, show data of the calling session */ - session = getenv("XDG_SESSION_ID"); - if (session) { - r = get_session_path(bus, session, &error, &path); - if (r < 0) - return log_error_errno(r, "Failed to get session path: %s", bus_error_message(&error, r)); - - p = path; - } - - return print_session_status_info(bus, p, &new_line); + return print_session_status_info(bus, "/org/freedesktop/login1/session/auto", &new_line); } for (i = 1; i < argc; i++) { @@ -895,8 +883,7 @@ static int show_user(int argc, char *argv[], void *userdata) { (void) pager_open(arg_pager_flags); if (argc <= 1) { - /* If not argument is specified inspect the manager - * itself */ + /* If no argument is specified inspect the manager itself */ if (properties) return show_properties(bus, "/org/freedesktop/login1", &new_line); @@ -953,12 +940,11 @@ static int show_seat(int argc, char *argv[], void *userdata) { (void) pager_open(arg_pager_flags); if (argc <= 1) { - /* If not argument is specified inspect the manager - * itself */ + /* If no argument is specified inspect the manager itself */ if (properties) return show_properties(bus, "/org/freedesktop/login1", &new_line); - return print_seat_status_info(bus, "/org/freedesktop/login1/seat/self", &new_line); + return print_seat_status_info(bus, "/org/freedesktop/login1/seat/auto", &new_line); } for (i = 1; i < argc; i++) { @@ -1005,11 +991,8 @@ static int activate(int argc, char *argv[], void *userdata) { polkit_agent_open_if_enabled(arg_transport, arg_ask_password); if (argc < 2) { - /* No argument? Let's either use $XDG_SESSION_ID (if specified), or an empty - * session name, in which case logind will try to guess our session. */ - short_argv[0] = argv[0]; - short_argv[1] = getenv("XDG_SESSION_ID") ?: (char*) ""; + short_argv[1] = (char*) ""; short_argv[2] = NULL; argv = short_argv; @@ -1030,7 +1013,7 @@ static int activate(int argc, char *argv[], void *userdata) { &error, NULL, "s", argv[i]); if (r < 0) - return log_error_errno(r, "Failed to issue method call: %s", bus_error_message(&error, -r)); + return log_error_errno(r, "Failed to issue method call: %s", bus_error_message(&error, r)); } return 0; |