]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
who: fix -m with guessed tty names
authorLukáš Zaoral <lzaoral@redhat.com>
Mon, 24 Feb 2025 09:36:35 +0000 (10:36 +0100)
committerPádraig Brady <P@draigBrady.com>
Mon, 24 Feb 2025 15:33:17 +0000 (15:33 +0000)
* who.c (scan_entries): Account for guessed tty names (e.g.
'sshd pts/1') from the readutmp module when using the systemd backend.
* bootstrap.conf (gnulib_modules): Add str_endswith.
* News: Mention the bug fix.
Addresses https://bugzilla.redhat.com/2343998

NEWS
bootstrap.conf
src/who.c

diff --git a/NEWS b/NEWS
index 981ffa7b43a99a831255a393304b09b49e1cf34d..e7bc3884cbc2993dceb8a687c9833376a9d3cfdf 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,10 @@ GNU coreutils NEWS                                    -*- outline -*-
   'ls -Z dir' would crash.
   [bug introduced in coreutils-9.6]
 
+  'who -m' now outputs entries for remote logins.  Previously login
+  entries prefixed with the service (like "sshd") were not matched.
+  [bug introduced in coreutils-9.4]
+
 
 * Noteworthy changes in release 9.6 (2025-01-17) [stable]
 
index 380fa1120eaf47697e83ad845ef49875c6ccdc1c..c99838e95a2e4a59cd6b9d25f567f0622dab45f5 100644 (file)
@@ -253,6 +253,7 @@ gnulib_modules="
   stdckdint-h
   stdlib-safer
   stpcpy
+  str_endswith
   strdup-posix
   strnlen
   strnumcmp
index b56a1ace624f8414ee2729baddfab89b48303c3b..17c1e34acfcdc539676cd39e1897e6b2acd79111 100644 (file)
--- a/src/who.c
+++ b/src/who.c
@@ -577,7 +577,7 @@ scan_entries (idx_t n, struct gl_utmp const *utmp_buf)
   while (n--)
     {
       if (!my_line_only
-          || STREQ (ttyname_b, utmp_buf->ut_line))
+          || str_endswith (utmp_buf->ut_line, ttyname_b))
         {
           if (need_users && IS_USER_PROCESS (utmp_buf))
             print_user (utmp_buf, boottime);