mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-13 14:40:22 +00:00
Prevent races running the queue by serializing access to the
queue directory. PR: bin/113239
This commit is contained in:
parent
e1de133c2e
commit
2b0cbe6d3a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=251625
@ -31,6 +31,7 @@ static const char rcsid[] =
|
||||
/* System Headers */
|
||||
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#ifdef __FreeBSD__
|
||||
@ -521,6 +522,9 @@ main(int argc, char *argv[])
|
||||
if ((spool = opendir(".")) == NULL)
|
||||
perr("cannot read %s", ATJOB_DIR);
|
||||
|
||||
if (flock(dirfd(spool), LOCK_EX) == -1)
|
||||
perr("cannot lock %s", ATJOB_DIR);
|
||||
|
||||
now = time(NULL);
|
||||
run_batch = 0;
|
||||
batch_uid = (uid_t) -1;
|
||||
|
Loading…
Reference in New Issue
Block a user