]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
wall: make sure ut_line is not empty
authorKarel Zak <kzak@redhat.com>
Thu, 6 Jun 2019 10:33:03 +0000 (12:33 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 6 Jun 2019 10:33:03 +0000 (12:33 +0200)
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1711574
Signed-off-by: Karel Zak <kzak@redhat.com>
term-utils/wall.c

index c606e634744fe0df95a9e35a2b646ab1e4afdef6..c3e89bab9f8bfe357e3a00602eaa7d0a658cfcff 100644 (file)
@@ -250,10 +250,12 @@ int main(int argc, char **argv)
                if (utmpptr->ut_type != USER_PROCESS)
                        continue;
 #endif
-               /* Joey Hess reports that use-sessreg in /etc/X11/wdm/
-                  produces ut_line entries like :0, and a write
-                  to /dev/:0 fails. */
-               if (utmpptr->ut_line[0] == ':')
+               /* Joey Hess reports that use-sessreg in /etc/X11/wdm/ produces
+                * ut_line entries like :0, and a write to /dev/:0 fails.
+                *
+                * It also seems that some login manager may produce empty ut_line.
+                */
+               if (!*utmpptr->ut_line || *utmpptr->ut_line == ':')
                        continue;
 
                if (group_buf && !is_gr_member(utmpptr->ut_user, group_buf))