Date: Mon, 25 Jul 2005 10:09:00 +0200 (CEST) From: Andre Albsmeier <Andre.Albsmeier@siemens.com> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/84041: [PATCH] fix for wall(1) error message Message-ID: <200507250809.j6P890cL021348@curry.mchp.siemens.de> Resent-Message-ID: <200507250810.j6P8ANw2091206@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 84041 >Category: bin >Synopsis: [PATCH] fix for wall(1) error message >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Jul 25 08:10:22 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Andre Albsmeier >Release: FreeBSD 5.4-STABLE i386 >Organization: >Environment: FreeBSD 5.4-STABLE #2: Tue Jul 12 13:55:14 CEST 2005 Xorg installed >Description: When a user is logged in via xdm, pam_lastlog updates utmp with an entry where ut_line reads ":0". If wall(1) is now used it emits an error message: wall: /dev/:0: No such file or directory >How-To-Repeat: Login via xdm. su to root and do "echo bla | wall". >Fix: Let wall.c check the ut_line entry (as it is done in ttystat() of usr.bin/w/w.c): --- usr.bin/wall/wall.c.ORI Sun Jul 24 08:20:41 2005 +++ usr.bin/wall/wall.c Sun Jul 24 09:13:49 2005 @@ -138,8 +138,13 @@ iov.iov_len = mbufsize; /* NOSTRICT */ while (fread((char *)&utmp, sizeof(utmp), 1, fp) == 1) { + static struct stat sb; + char ttybuf[MAXPATHLEN]; if (!utmp.ut_name[0]) continue; + snprintf(ttybuf, sizeof(ttybuf), "%s%.*s", _PATH_DEV, UT_LINESIZE, utmp.ut_line); + if (stat(ttybuf, &sb) != 0) + continue; /* corrupted record */ if (grouplist) { ingroup = 0; strlcpy(username, utmp.ut_name, sizeof(utmp.ut_name)); >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200507250809.j6P890cL021348>