usr.bin/who.c: Fix boot time checking
The boot time entry doesn't have a tty specified, so don't check it. While here, make ttystat handle that case. Approved by: kevans (src) Differential Revision: https://reviews.freebsd.org/D34524
This commit is contained in:
parent
5fc3cc2713
commit
db11c57a6c
@ -216,6 +216,8 @@ ttystat(char *line)
|
||||
struct stat sb;
|
||||
char ttybuf[MAXPATHLEN];
|
||||
|
||||
if (line == NULL)
|
||||
return (0);
|
||||
(void)snprintf(ttybuf, sizeof(ttybuf), "%s%s", _PATH_DEV, line);
|
||||
if (stat(ttybuf, &sb) == 0) {
|
||||
return (0);
|
||||
@ -229,10 +231,11 @@ process_utmp(void)
|
||||
struct utmpx *utx;
|
||||
|
||||
while ((utx = getutxent()) != NULL) {
|
||||
if (((aflag || !bflag) && utx->ut_type == USER_PROCESS) ||
|
||||
(bflag && utx->ut_type == BOOT_TIME))
|
||||
if ((aflag || !bflag) && utx->ut_type == USER_PROCESS) {
|
||||
if (ttystat(utx->ut_line) == 0)
|
||||
row(utx);
|
||||
} else if (bflag && utx->ut_type == BOOT_TIME)
|
||||
row(utx);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user