From owner-svn-src-stable-9@FreeBSD.ORG Wed Aug 29 19:17:30 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 18290106564A; Wed, 29 Aug 2012 19:17:30 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0277A8FC16; Wed, 29 Aug 2012 19:17:30 +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 q7TJHTbi099699; Wed, 29 Aug 2012 19:17:29 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7TJHTZR099697; Wed, 29 Aug 2012 19:17:29 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201208291917.q7TJHTZR099697@svn.freebsd.org> From: John Baldwin Date: Wed, 29 Aug 2012 19:17:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239876 - stable/9/usr.sbin/cron/crontab X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 19:17:30 -0000 Author: jhb Date: Wed Aug 29 19:17:29 2012 New Revision: 239876 URL: http://svn.freebsd.org/changeset/base/239876 Log: MFC 238024: Add a one second sleep before touching the spool directory. If the touch occurs in the same second as the earlier operations to create the temporary file and the cron(8) daemon is rescans the spool directory during that second, then the daemon may miss a cron edit and not properly update its internal database. Modified: stable/9/usr.sbin/cron/crontab/crontab.c Directory Properties: stable/9/usr.sbin/cron/crontab/ (props changed) Modified: stable/9/usr.sbin/cron/crontab/crontab.c ============================================================================== --- stable/9/usr.sbin/cron/crontab/crontab.c Wed Aug 29 19:12:53 2012 (r239875) +++ stable/9/usr.sbin/cron/crontab/crontab.c Wed Aug 29 19:17:29 2012 (r239876) @@ -608,6 +608,15 @@ replace_cmd() { log_it(RealUser, Pid, "REPLACE", User); + /* + * Creating the 'tn' temp file has already updated the + * modification time of the spool directory. Sleep for a + * second to ensure that poke_daemon() sets a later + * modification time. Otherwise, this can race with the cron + * daemon scanning for updated crontabs. + */ + sleep(1); + poke_daemon(); return (0);