summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2010-01-14 15:20:09 +0000
committered <ed@FreeBSD.org>2010-01-14 15:20:09 +0000
commit64aac684586e30062e84858aef4672ac29360039 (patch)
treeb8dd483b4ebbe308a19e13dee5a813803ee92222 /lib
parent364b010af6a6ca8bd16558ad86b53326d84eaf5a (diff)
downloadFreeBSD-src-64aac684586e30062e84858aef4672ac29360039.zip
FreeBSD-src-64aac684586e30062e84858aef4672ac29360039.tar.gz
Unbreak pututxline() on 32-bit architectures.
I forgot to cast the size_t's back to off_t before negating them, causing all sorts of artifacts where the log files would grow to 2^32 - 197 bytes. Reported by: ume
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/gen/pututxline.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/libc/gen/pututxline.c b/lib/libc/gen/pututxline.c
index c0440df..94c63bd 100644
--- a/lib/libc/gen/pututxline.c
+++ b/lib/libc/gen/pututxline.c
@@ -87,7 +87,7 @@ utx_active_add(const struct futx *fu)
case DEAD_PROCESS:
/* Overwrite when ut_id matches. */
if (memcmp(fu->fu_id, fe.fu_id, sizeof fe.fu_id) == 0) {
- fseeko(fp, -sizeof fe, SEEK_CUR);
+ fseeko(fp, -(off_t)sizeof fe, SEEK_CUR);
goto exact;
}
if (fe.fu_type != DEAD_PROCESS)
@@ -96,7 +96,7 @@ utx_active_add(const struct futx *fu)
default:
/* Allow us to overwrite unused records. */
if (partial == -1)
- partial = ftello(fp) - sizeof fe;
+ partial = ftello(fp) - (off_t)sizeof fe;
break;
}
}
@@ -140,7 +140,7 @@ utx_active_remove(struct futx *fu)
fu->fu_tv = fe.fu_tv;
/* Terminate session. */
- fseeko(fp, -sizeof fe, SEEK_CUR);
+ fseeko(fp, -(off_t)sizeof fe, SEEK_CUR);
fwrite(fu, sizeof *fu, 1, fp);
fclose(fp);
return (0);
@@ -181,7 +181,7 @@ utx_lastlogin_add(const struct futx *fu)
goto done;
/* Found a previous lastlogin entry for this user. */
- fseeko(fp, -sizeof fe, SEEK_CUR);
+ fseeko(fp, -(off_t)sizeof fe, SEEK_CUR);
break;
}
fwrite(fu, sizeof *fu, 1, fp);
OpenPOWER on IntegriCloud