diff options
author | Iain Lane <iain@orangesquash.org.uk> | 2018-01-05 11:53:34 +0000 |
---|---|---|
committer | Benjamin Berg <benjamin@sipsolutions.net> | 2019-08-05 21:43:50 +0000 |
commit | fcba1e1a5d556ce7b52101dbd2d1ba4a19469161 (patch) | |
tree | 45b971f62cc9a1c50afb223ba54e2d5af6c585ac /libgdm | |
parent | f5305339390a4160434bdd19f80dcc4806d33329 (diff) | |
download | gdm-fcba1e1a5d556ce7b52101dbd2d1ba4a19469161.tar.gz |
manager: Find user's current graphical session, not session of callerwip/benzea/systemd-user
If (e.g.) gnome-shell is started as a systemd --user unit, it won't be
part of the login session. We should instead look through all of the
user's sessions until we find the login session, and take that as our
session.
Diffstat (limited to 'libgdm')
-rw-r--r-- | libgdm/Makefile.am | 1 | ||||
-rw-r--r-- | libgdm/gdm-user-switching.c | 8 |
2 files changed, 4 insertions, 5 deletions
diff --git a/libgdm/Makefile.am b/libgdm/Makefile.am index 88534a54..fadffbec 100644 --- a/libgdm/Makefile.am +++ b/libgdm/Makefile.am @@ -66,6 +66,7 @@ libgdm_la_LDFLAGS = \ $(END_OF_LIST) libgdm_la_LIBADD = \ + $(top_builddir)/common/libgdmcommon.la \ $(LIBGDM_LIBS) \ $(SYSTEMD_LIBS) \ $(END_OF_LIST) diff --git a/libgdm/gdm-user-switching.c b/libgdm/gdm-user-switching.c index 3d4303e3..3a33fcbb 100644 --- a/libgdm/gdm-user-switching.c +++ b/libgdm/gdm-user-switching.c @@ -191,6 +191,7 @@ goto_login_session (GDBusConnection *connection, char *our_session; char *session_id; char *seat_id; + GError *local_error = NULL; ret = FALSE; session_id = NULL; @@ -202,11 +203,8 @@ goto_login_session (GDBusConnection *connection, /* Note that we mostly use free () here, instead of g_free () * since the data allocated is from libsystemd-logind, which * does not use GLib's g_malloc (). */ - - res = sd_pid_get_session (0, &our_session); - if (res < 0) { - g_debug ("failed to determine own session: %s", strerror (-res)); - g_set_error (error, GDM_CLIENT_ERROR, 0, _("Could not identify the current session.")); + if (!gdm_find_display_session_for_uid (getuid (), &our_session, &local_error)) { + g_propagate_prefixed_error (error, local_error, _("Could not identify the current session: ")); return FALSE; } |