diff options
author | ed <ed@FreeBSD.org> | 2010-01-23 08:43:21 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2010-01-23 08:43:21 +0000 |
commit | a7d4005f80a992c3d31951774fbda2cf95479028 (patch) | |
tree | 92b52fcc0975fd958bf91fd6feff11e044dde4a9 /lib/libc/gen/pututxline.c | |
parent | dace1f6d748e9b099a9a3e8799a5cf79d543b256 (diff) | |
download | FreeBSD-src-a7d4005f80a992c3d31951774fbda2cf95479028.zip FreeBSD-src-a7d4005f80a992c3d31951774fbda2cf95479028.tar.gz |
Just ignore the timestamps given to pututxline().
I've noticed many applications do a bad job at timekeeping, for several
reasons:
- Applications like screen(1) don't update time records when restoring
the old user login record.
- Many applications only set ut_tv.tv_sec, not ut_tv.tv_usec.
This causes many problems for tools such as ac(8), which require the
timestamps to be properly ordered. This is why I've decided to let the
utmpx code obtain valid timestamps itself.
Diffstat (limited to 'lib/libc/gen/pututxline.c')
-rw-r--r-- | lib/libc/gen/pututxline.c | 12 |
1 files changed, 0 insertions, 12 deletions
diff --git a/lib/libc/gen/pututxline.c b/lib/libc/gen/pututxline.c index 1239531..ce4dc28 100644 --- a/lib/libc/gen/pututxline.c +++ b/lib/libc/gen/pututxline.c @@ -132,13 +132,6 @@ utx_active_remove(struct futx *fu) if (memcmp(fu->fu_id, fe.fu_id, sizeof fe.fu_id) != 0) continue; - /* - * Prevent login sessions from having a negative - * timespan. - */ - if (be64toh(fu->fu_tv) < be64toh(fe.fu_tv)) - fu->fu_tv = fe.fu_tv; - /* Terminate session. */ fseeko(fp, -(off_t)sizeof fe, SEEK_CUR); fwrite(fu, sizeof *fu, 1, fp); @@ -175,17 +168,12 @@ utx_lastlogin_add(const struct futx *fu) while (fread(&fe, sizeof fe, 1, fp) == 1) { if (strncmp(fu->fu_user, fe.fu_user, sizeof fe.fu_user) != 0) continue; - - /* Prevent lowering the time value. */ - if (be64toh(fu->fu_tv) <= be64toh(fe.fu_tv)) - goto done; /* Found a previous lastlogin entry for this user. */ fseeko(fp, -(off_t)sizeof fe, SEEK_CUR); break; } fwrite(fu, sizeof *fu, 1, fp); -done: fclose(fp); } |