diff options
Diffstat (limited to 'usr.bin/lastcomm/lastcomm.c')
-rw-r--r-- | usr.bin/lastcomm/lastcomm.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/usr.bin/lastcomm/lastcomm.c b/usr.bin/lastcomm/lastcomm.c index 7c3c363..749d8cf 100644 --- a/usr.bin/lastcomm/lastcomm.c +++ b/usr.bin/lastcomm/lastcomm.c @@ -38,7 +38,7 @@ static char copyright[] = #endif /* not lint */ #ifndef lint -static char sccsid[] = "@(#)lastcomm.c 8.1 (Berkeley) 6/6/93"; +static char sccsid[] = "@(#)lastcomm.c 8.2 (Berkeley) 4/29/95"; #endif /* not lint */ #include <sys/param.h> @@ -183,13 +183,10 @@ requested(argv, acp) register char *argv[]; register struct acct *acp; { - register char *p; - do { - p = user_from_uid(acp->ac_uid, 0); - if (!strcmp(p, *argv)) + if (!strcmp(user_from_uid(acp->ac_uid, 0), *argv)) return (1); - if ((p = getdev(acp->ac_tty)) && !strcmp(p, *argv)) + if (!strcmp(getdev(acp->ac_tty), *argv)) return (1); if (!strncmp(acp->ac_comm, *argv, fldsiz(acct, ac_comm))) return (1); @@ -209,7 +206,8 @@ getdev(dev) if (dev == lastdev) /* One-element cache. */ return (lastname); lastdev = dev; - lastname = devname(dev, S_IFCHR); + if ((lastname = devname(dev, S_IFCHR)) == NULL) + lastname = "??"; return (lastname); } |