From owner-svn-src-head@FreeBSD.ORG Fri Feb 10 13:40:32 2012 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 A3ED31065670; Fri, 10 Feb 2012 13:40:32 +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 8EDDC8FC0C; Fri, 10 Feb 2012 13:40:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1ADeWH7076599; Fri, 10 Feb 2012 13:40:32 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1ADeWDj076596; Fri, 10 Feb 2012 13:40:32 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201202101340.q1ADeWDj076596@svn.freebsd.org> From: Ed Schouten Date: Fri, 10 Feb 2012 13:40:32 +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: r231383 - in head: lib/libutil usr.sbin/vipw 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, 10 Feb 2012 13:40:32 -0000 Author: ed Date: Fri Feb 10 13:40:32 2012 New Revision: 231383 URL: http://svn.freebsd.org/changeset/base/231383 Log: Detect file modification properly by using tv_nsec. POSIX 2008 standardizes st_mtim, meaning we can simply use nanosecond precision to detect file modification. MFC after: 2 weeks Modified: head/lib/libutil/pw_util.c head/usr.sbin/vipw/vipw.8 Modified: head/lib/libutil/pw_util.c ============================================================================== --- head/lib/libutil/pw_util.c Fri Feb 10 13:36:39 2012 (r231382) +++ head/lib/libutil/pw_util.c Fri Feb 10 13:40:32 2012 (r231383) @@ -347,7 +347,8 @@ pw_edit(int notsetuid) sigprocmask(SIG_SETMASK, &oldsigset, NULL); if (stat(tempname, &st2) == -1) return (-1); - return (st1.st_mtime != st2.st_mtime); + return (st1.st_mtim.tv_sec != st2.st_mtim.tv_sec || + st1.st_mtim.tv_nsec != st2.st_mtim.tv_nsec); } /* Modified: head/usr.sbin/vipw/vipw.8 ============================================================================== --- head/usr.sbin/vipw/vipw.8 Fri Feb 10 13:36:39 2012 (r231382) +++ head/usr.sbin/vipw/vipw.8 Fri Feb 10 13:40:32 2012 (r231383) @@ -28,7 +28,7 @@ .\" @(#)vipw.8 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd June 6, 1993 +.Dd February 10, 2011 .Dt VIPW 8 .Os .Sh NAME @@ -110,10 +110,3 @@ The .Nm utility appeared in .Bx 4.0 . -.Sh BUGS -The mechanism for checking for password file modifications requires that -.Ev EDITOR -run for at least one second. -Non-interactive editor scripts should invoke -.Xr sleep 1 -or equivalent to ensure this happens.