1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-27 08:00:11 +00:00

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.
This commit is contained in:
Ed Schouten 2009-12-25 20:04:36 +00:00
parent 095809b084
commit bfa3a5e5bc
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=200996

View File

@ -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);