summaryrefslogtreecommitdiffstats
path: root/usr.bin/w/w.c
diff options
context:
space:
mode:
authorseanc <seanc@FreeBSD.org>2002-08-23 04:31:58 +0000
committerseanc <seanc@FreeBSD.org>2002-08-23 04:31:58 +0000
commitad6e76463238a2baf48c1a7a91639c53faa4b391 (patch)
treebff748bba2d18e29c482fa65dadf5f77f5c97c93 /usr.bin/w/w.c
parente528806f994ecb3c23bf174011c94e71abaf5073 (diff)
downloadFreeBSD-src-ad6e76463238a2baf48c1a7a91639c53faa4b391.zip
FreeBSD-src-ad6e76463238a2baf48c1a7a91639c53faa4b391.tar.gz
Fix warning when calling w(1) when logged in via xdm/kdm. This is
really a problem with utmp/wtmp, but takes the same approach as who(1). Reviewed by: knu (mentor), mini, silence on -audit Approved by: knu (mentor), mini
Diffstat (limited to 'usr.bin/w/w.c')
-rw-r--r--usr.bin/w/w.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/usr.bin/w/w.c b/usr.bin/w/w.c
index e93630f..7d3907b 100644
--- a/usr.bin/w/w.c
+++ b/usr.bin/w/w.c
@@ -491,11 +491,10 @@ ttystat(char *line, int sz)
char ttybuf[MAXPATHLEN];
(void)snprintf(ttybuf, sizeof(ttybuf), "%s%.*s", _PATH_DEV, sz, line);
- if (stat(ttybuf, &sb)) {
- warn("%s", ttybuf);
+ if (stat(ttybuf, &sb) == 0) {
+ return (&sb);
+ } else
return (NULL);
- }
- return (&sb);
}
static void
OpenPOWER on IntegriCloud