From owner-svn-src-all@FreeBSD.ORG Thu Jan 14 15:20:09 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A981106566B; Thu, 14 Jan 2010 15:20:09 +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 597228FC0A; Thu, 14 Jan 2010 15:20:09 +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 o0EFK9A4068870; Thu, 14 Jan 2010 15:20:09 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o0EFK9L7068868; Thu, 14 Jan 2010 15:20:09 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201001141520.o0EFK9L7068868@svn.freebsd.org> From: Ed Schouten Date: Thu, 14 Jan 2010 15:20:09 +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: r202287 - head/lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jan 2010 15:20:09 -0000 Author: ed Date: Thu Jan 14 15:20:09 2010 New Revision: 202287 URL: http://svn.freebsd.org/changeset/base/202287 Log: Unbreak pututxline() on 32-bit architectures. I forgot to cast the size_t's back to off_t before negating them, causing all sorts of artifacts where the log files would grow to 2^32 - 197 bytes. Reported by: ume Modified: head/lib/libc/gen/pututxline.c Modified: head/lib/libc/gen/pututxline.c ============================================================================== --- head/lib/libc/gen/pututxline.c Thu Jan 14 15:07:18 2010 (r202286) +++ head/lib/libc/gen/pututxline.c Thu Jan 14 15:20:09 2010 (r202287) @@ -87,7 +87,7 @@ utx_active_add(const struct futx *fu) case DEAD_PROCESS: /* Overwrite when ut_id matches. */ if (memcmp(fu->fu_id, fe.fu_id, sizeof fe.fu_id) == 0) { - fseeko(fp, -sizeof fe, SEEK_CUR); + fseeko(fp, -(off_t)sizeof fe, SEEK_CUR); goto exact; } if (fe.fu_type != DEAD_PROCESS) @@ -96,7 +96,7 @@ utx_active_add(const struct futx *fu) default: /* Allow us to overwrite unused records. */ if (partial == -1) - partial = ftello(fp) - sizeof fe; + partial = ftello(fp) - (off_t)sizeof fe; break; } } @@ -140,7 +140,7 @@ utx_active_remove(struct futx *fu) fu->fu_tv = fe.fu_tv; /* Terminate session. */ - fseeko(fp, -sizeof fe, SEEK_CUR); + fseeko(fp, -(off_t)sizeof fe, SEEK_CUR); fwrite(fu, sizeof *fu, 1, fp); fclose(fp); return (0); @@ -181,7 +181,7 @@ utx_lastlogin_add(const struct futx *fu) goto done; /* Found a previous lastlogin entry for this user. */ - fseeko(fp, -sizeof fe, SEEK_CUR); + fseeko(fp, -(off_t)sizeof fe, SEEK_CUR); break; } fwrite(fu, sizeof *fu, 1, fp);