aboutsummaryrefslogtreecommitdiff
path: root/libexec/atrun
diff options
context:
space:
mode:
authorSimon J. Gerraty <sjg@FreeBSD.org>2013-09-05 20:18:59 +0000
committerSimon J. Gerraty <sjg@FreeBSD.org>2013-09-05 20:18:59 +0000
commitd1d015864103b253b3fcb2f72a0da5b0cfeb31b6 (patch)
tree22b131dceb13c3df96da594fbaadb693504797c7 /libexec/atrun
parent12d4083451fc39b3e831d4ea0bfa67d3b32cfb54 (diff)
parentb6f49c23a36f329cbf1e7f28078e17fd87f0e245 (diff)
Notes
Diffstat (limited to 'libexec/atrun')
-rw-r--r--libexec/atrun/atrun.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libexec/atrun/atrun.c b/libexec/atrun/atrun.c
index 8b0315e94451..594107e3d2c1 100644
--- a/libexec/atrun/atrun.c
+++ b/libexec/atrun/atrun.c
@@ -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__
@@ -197,7 +198,7 @@ run_file(const char *filename, uid_t uid, gid_t gid)
PRIV_END
if (stream == NULL)
- perr("cannot open input file");
+ perr("cannot open input file %s", filename);
if ((fd_in = dup(fileno(stream))) <0)
perr("error duplicating input file descriptor");
@@ -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;