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);
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to