summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.bin/w/w.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.bin/w/w.c b/usr.bin/w/w.c
index 43f1926..0331287 100644
--- a/usr.bin/w/w.c
+++ b/usr.bin/w/w.c
@@ -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);
OpenPOWER on IntegriCloud