]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
logind: pick up tty info from utmp only for tty sessions 38034/head
authorLennart Poettering <lennart@poettering.net>
Wed, 2 Jul 2025 14:25:42 +0000 (16:25 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 2 Jul 2025 14:25:42 +0000 (16:25 +0200)
Let's tighten the rules for picking up TTY information from utmp: let's
do so only for TTY session, nothing else. Apparently people have issues
with graphical sessions with certain terminal emulators that install
entries in utmp for each emulator window.

Alternative for: #38027

src/login/logind-utmp.c

index 8f6914f7250cbc7628315be1b06827bed237dcde..26ebb35c64e40db2ff6d907255bd6c172902138b 100644 (file)
@@ -59,6 +59,9 @@ int manager_read_utmp(Manager *m) {
                 if (manager_get_session_by_pidref(m, &PIDREF_MAKE_FROM_PID(u->ut_pid), &s) <= 0)
                         continue;
 
+                if (s->type != SESSION_TTY)
+                        continue;
+
                 if (s->tty_validity == TTY_FROM_UTMP && !streq_ptr(s->tty, t)) {
                         /* This may happen on multiplexed SSH connection (i.e. 'SSH connection sharing'). In
                          * this case PAM and utmp sessions don't match. In such a case let's invalidate the TTY