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
This commit is contained in:
Sean Chittenden 2002-08-23 04:31:58 +00:00
parent 79458607f6
commit d0d0355e4d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=102300

View File

@ -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