From owner-svn-src-head@FreeBSD.ORG Fri Dec 25 20:04:36 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD1E4106568D; Fri, 25 Dec 2009 20:04:36 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CBC338FC1D; Fri, 25 Dec 2009 20:04:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBPK4a1Z070249; Fri, 25 Dec 2009 20:04:36 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBPK4arI070247; Fri, 25 Dec 2009 20:04:36 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200912252004.nBPK4arI070247@svn.freebsd.org> From: Ed Schouten Date: Fri, 25 Dec 2009 20:04:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200996 - head/lib/libulog X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Dec 2009 20:04:37 -0000 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);