Date: Tue, 5 Jul 2011 14:12:48 +0000 (UTC) From: Ed Schouten <ed@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r223786 - head/usr.bin/w Message-ID: <201107051412.p65ECmhE072514@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ed Date: Tue Jul 5 14:12:48 2011 New Revision: 223786 URL: http://svn.freebsd.org/changeset/base/223786 Log: Only print entries for which ut_host points to a character device. Now that we use utmpx, we more often have entries for which the ut_line is left blank. To prevent us from returning struct stat for "/dev/", check that the resulting stat structure belongs to a character device. Modified: head/usr.bin/w/w.c Modified: head/usr.bin/w/w.c ============================================================================== --- head/usr.bin/w/w.c Tue Jul 5 13:45:10 2011 (r223785) +++ head/usr.bin/w/w.c Tue Jul 5 14:12:48 2011 (r223786) @@ -497,7 +497,7 @@ ttystat(char *line) char ttybuf[MAXPATHLEN]; (void)snprintf(ttybuf, sizeof(ttybuf), "%s%s", _PATH_DEV, line); - if (stat(ttybuf, &sb) == 0) { + if (stat(ttybuf, &sb) == 0 && S_ISCHR(sb.st_mode)) { return (&sb); } else return (NULL);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201107051412.p65ECmhE072514>