Author: jhb
Date: Mon Jul  2 20:27:37 2012
New Revision: 238024
URL: http://svn.freebsd.org/changeset/base/238024

Log:
  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.
  
  MFC after:    1 month

Modified:
  head/usr.sbin/cron/crontab/crontab.c

Modified: head/usr.sbin/cron/crontab/crontab.c
==============================================================================
--- head/usr.sbin/cron/crontab/crontab.c        Mon Jul  2 20:26:11 2012        
(r238023)
+++ head/usr.sbin/cron/crontab/crontab.c        Mon Jul  2 20:27:37 2012        
(r238024)
@@ -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);
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to