diff options
author | 1997-03-03 03:25:10 +0000 | |
---|---|---|
committer | 1997-03-03 03:25:10 +0000 | |
commit | 5ac84c996e24c5005ad9be09f8921e1502b0cb96 (patch) | |
tree | e400fb3db01d10d7d7ee46a0fa8215406f9b76ed | |
parent | fix typo (diff) | |
download | wireguard-openbsd-5ac84c996e24c5005ad9be09f8921e1502b0cb96.tar.xz wireguard-openbsd-5ac84c996e24c5005ad9be09f8921e1502b0cb96.zip |
don't try to fseek to before the beginning of the file;
showed up after the fix to sys_lseek concerning negative offsets.
avoids '/var/account/acct: Invalid argument' messages.
-rw-r--r-- | usr.bin/lastcomm/lastcomm.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.bin/lastcomm/lastcomm.c b/usr.bin/lastcomm/lastcomm.c index f47688fab0a..66478b358ad 100644 --- a/usr.bin/lastcomm/lastcomm.c +++ b/usr.bin/lastcomm/lastcomm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lastcomm.c,v 1.4 1997/01/15 23:42:41 millert Exp $ */ +/* $OpenBSD: lastcomm.c,v 1.5 1997/03/03 03:25:10 flipk Exp $ */ /* $NetBSD: lastcomm.c,v 1.9 1995/10/22 01:43:42 ghudson Exp $ */ /* @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)lastcomm.c 8.2 (Berkeley) 4/29/95"; #endif -static char rcsid[] = "$OpenBSD: lastcomm.c,v 1.4 1997/01/15 23:42:41 millert Exp $"; +static char rcsid[] = "$OpenBSD: lastcomm.c,v 1.5 1997/03/03 03:25:10 flipk Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -128,8 +128,6 @@ main(argc, argv) if (fseek(fp, 2 * -(long)sizeof(struct acct), SEEK_CUR) == -1) err(1, "%s", acctfile); - if (size == 0) - break; size -= sizeof(struct acct); if (ab.ac_comm[0] == '\0') { @@ -154,6 +152,9 @@ main(argc, argv) delta / SECSPERHOUR, fmod(delta, SECSPERHOUR) / SECSPERMIN, fmod(delta, SECSPERMIN)); + + if (size == 0) + break; } exit(0); } |