* 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.
---
 bootstrap.conf | 1 +
 src/who.c      | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/bootstrap.conf b/bootstrap.conf
index 380fa1120..c99838e95 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -253,6 +253,7 @@ gnulib_modules="
   stdckdint-h
   stdlib-safer
   stpcpy
+  str_endswith
   strdup-posix
   strnlen
   strnumcmp
diff --git a/src/who.c b/src/who.c
index b56a1ace6..13e1b76d4 100644
--- 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);
-- 
2.48.1


Reply via email to