summaryrefslogtreecommitdiffstats
path: root/lib/libulog
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2009-12-25 20:04:36 +0000
committered <ed@FreeBSD.org>2009-12-25 20:04:36 +0000
commitb2c0c6915e138dcf4d112d0e6d98035760ac1851 (patch)
tree65788586dcf8b401710ad609f455808ea4ecf0bd /lib/libulog
parent97711237c0459d52f59f829adba13ebc999b681b (diff)
downloadFreeBSD-src-b2c0c6915e138dcf4d112d0e6d98035760ac1851.zip
FreeBSD-src-b2c0c6915e138dcf4d112d0e6d98035760ac1851.tar.gz
Don't corrupt logout entries in utmp files.
An older version of the code used a structure on the stack, instead of a pointer to the structure. It looks like I didn't adjust the parameters of the write(2) call, causing the first four/eight bytes of the entry to be corrupted, instead of writing the entire entry to disk.
Diffstat (limited to 'lib/libulog')
-rw-r--r--lib/libulog/ulog_pututxline.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libulog/ulog_pututxline.c b/lib/libulog/ulog_pututxline.c
index d02dda5..d0e7951 100644
--- a/lib/libulog/ulog_pututxline.c
+++ b/lib/libulog/ulog_pututxline.c
@@ -126,7 +126,7 @@ ulog_write_utmp_slow(const struct futmp *ut)
strncmp(utf.ut_line, ut->ut_line, sizeof utf.ut_line) != 0)
continue;
lseek(fd, -(off_t)sizeof utf, SEEK_CUR);
- write(fd, &ut, sizeof ut);
+ write(fd, ut, sizeof *ut);
found = 1;
}
close(fd);
OpenPOWER on IntegriCloud