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:
seanc 2002-08-23 04:31:58 +00:00
parent 5eed5e140e
commit 2c6b9fc354

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