Fix from John Brezak for the following bug:
If there is a non-tty entry in utmp, w(1) will exit with an error. However there are legitimate non-tty entries, for instance an xlogin via xdm can be identified with the xlogin program. In this case there is an entry with the display name as the ut_tty.
This commit is contained in:
parent
59ca7c5f1f
commit
cc3bb2da02
|
@ -191,7 +191,8 @@ main(argc, argv)
|
|||
*nextp = ep;
|
||||
nextp = &(ep->next);
|
||||
memmove(&(ep->utmp), &utmp, sizeof(struct utmp));
|
||||
stp = ttystat(ep->utmp.ut_line);
|
||||
if (!(stp = ttystat(ep->utmp.ut_line)))
|
||||
continue;
|
||||
ep->tdev = stp->st_rdev;
|
||||
#ifdef CPU_CONSDEV
|
||||
/*
|
||||
|
@ -410,7 +411,7 @@ ttystat(line)
|
|||
|
||||
(void)snprintf(ttybuf, sizeof(ttybuf), "%s/%s", _PATH_DEV, line);
|
||||
if (stat(ttybuf, &sb))
|
||||
err(1, "%s", ttybuf);
|
||||
return (NULL);
|
||||
return (&sb);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue