summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Vollmer <mvollmer@redhat.com>2013-06-11 10:03:48 -0400
committerMatthias Clasen <mclasen@redhat.com>2013-06-11 10:03:48 -0400
commit8d2c6d3debf295c99dd228bf56922a89304ebe93 (patch)
tree0498e8b99ec960ec78f7c233ffbd21854bf72cfe
parent33b75f70f6d916149c003efb0dae842a96fa92a7 (diff)
Don't assume that we are part of a session or have a seat
In particular, don't assume that there is an active session on seat0 and that it is us.
-rw-r--r--src/libaccountsservice/act-user-manager.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/libaccountsservice/act-user-manager.c b/src/libaccountsservice/act-user-manager.c
index 9b48cf1..fd660e5 100644
--- a/src/libaccountsservice/act-user-manager.c
+++ b/src/libaccountsservice/act-user-manager.c
@@ -746,12 +746,12 @@ _get_systemd_seat_id (ActUserManager *manager)
int res;
char *seat_id;
- res = sd_session_get_seat (manager->priv->seat.session_id,
- &seat_id);
+ res = sd_session_get_seat (NULL, &seat_id);
- if (res < 0) {
- g_warning ("Could not get seat of session '%s': %s",
- manager->priv->seat.session_id,
+ if (res == -ENOENT) {
+ seat_id = NULL;
+ } else if (res < 0) {
+ g_warning ("Could not get current seat: %s",
strerror (-res));
unload_seat (manager);
return;
@@ -1148,9 +1148,11 @@ _get_current_systemd_session_id (ActUserManager *manager)
char *session_id;
int res;
- res = sd_seat_get_active ("seat0", &session_id, NULL);
+ res = sd_pid_get_session (0, &session_id);
- if (res < 0) {
+ if (res == -ENOENT) {
+ session_id = NULL;
+ } else if (res < 0) {
g_debug ("Failed to identify the current session: %s",
strerror (-res));
unload_seat (manager);