svn commit: r200996 - head/lib/libulog
Ed Schouten
ed at FreeBSD.org
Fri Dec 25 20:04:37 UTC 2009
Author: ed
Date: Fri Dec 25 20:04:36 2009
New Revision: 200996
URL: http://svn.freebsd.org/changeset/base/200996
Log:
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.
Modified:
head/lib/libulog/ulog_pututxline.c
Modified: head/lib/libulog/ulog_pututxline.c
==============================================================================
--- head/lib/libulog/ulog_pututxline.c Fri Dec 25 20:03:03 2009 (r200995)
+++ head/lib/libulog/ulog_pututxline.c Fri Dec 25 20:04:36 2009 (r200996)
@@ -126,7 +126,7 @@ ulog_write_utmp_slow(const struct futmp
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);
More information about the svn-src-head
mailing list