diff options
author | brian <brian@FreeBSD.org> | 2000-12-21 01:30:47 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 2000-12-21 01:30:47 +0000 |
commit | b92a08961bec1b7b6c9756c131e093978f2f9029 (patch) | |
tree | d1c038d90aabdf2f4ba7333b9e3524c81fd710da /usr.bin/finger | |
parent | 932e6061e717d0f8dfb16dc987042a473dff9ebc (diff) | |
download | FreeBSD-src-b92a08961bec1b7b6c9756c131e093978f2f9029.zip FreeBSD-src-b92a08961bec1b7b6c9756c131e093978f2f9029.tar.gz |
If the utmp login time is greater than the tty atime, use it to calculate
the idle time instead of the atime.
This makes entries for people that have logged in but done nothing
else show up correctly.
Reviewed by: markk@knigma.org
Diffstat (limited to 'usr.bin/finger')
-rw-r--r-- | usr.bin/finger/util.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.bin/finger/util.c b/usr.bin/finger/util.c index dbf5e5f..7823ef4 100644 --- a/usr.bin/finger/util.c +++ b/usr.bin/finger/util.c @@ -323,13 +323,19 @@ find_idle_and_ttywrite(w) { extern time_t now; struct stat sb; + time_t touched; (void)snprintf(tbuf, sizeof(tbuf), "%s/%s", _PATH_DEV, w->tty); if (stat(tbuf, &sb) < 0) { warn("%s", tbuf); return; } - w->idletime = now < sb.st_atime ? 0 : now - sb.st_atime; + touched = sb.st_atime; + if (touched < w->loginat) { + /* tty untouched since before login */ + touched = w->loginat; + } + w->idletime = now < touched ? 0 : now - touched; #define TALKABLE 0220 /* tty is writable if 220 mode */ w->writable = ((sb.st_mode & TALKABLE) == TALKABLE); |