summaryrefslogtreecommitdiffstats
path: root/term-utils
diff options
context:
space:
mode:
authorKarel Zak2019-06-06 12:33:03 +0200
committerKarel Zak2019-06-06 12:33:03 +0200
commit33985f1149598e9d5740cc6b851d979e3a8b84a5 (patch)
tree920555f6b51d4b5e748eba6de0d497e2a1f37ace /term-utils
parentlibblkid: fix detection of dm-integrity superblock version (diff)
downloadkernel-qcow2-util-linux-33985f1149598e9d5740cc6b851d979e3a8b84a5.tar.gz
kernel-qcow2-util-linux-33985f1149598e9d5740cc6b851d979e3a8b84a5.tar.xz
kernel-qcow2-util-linux-33985f1149598e9d5740cc6b851d979e3a8b84a5.zip
wall: make sure ut_line is not empty
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1711574 Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'term-utils')
-rw-r--r--term-utils/wall.c10
1 files 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))