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
This commit is contained in:
John Baldwin 2012-07-02 20:27:37 +00:00
parent 7b736a7a50
commit 5cdfc55cab

View file

@ -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);