From 33985f1149598e9d5740cc6b851d979e3a8b84a5 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 6 Jun 2019 12:33:03 +0200 Subject: wall: make sure ut_line is not empty Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1711574 Signed-off-by: Karel Zak --- term-utils/wall.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/term-utils/wall.c b/term-utils/wall.c index c606e6347..c3e89bab9 100644 --- a/term-utils/wall.c +++ b/term-utils/wall.c @@ -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)) -- cgit v1.2.3-55-g7522