Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Dec 2009 20:04:36 +0000 (UTC)
From:      Ed Schouten <ed@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r200996 - head/lib/libulog
Message-ID:  <200912252004.nBPK4arI070247@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912252004.nBPK4arI070247>