summaryrefslogtreecommitdiffstats
path: root/libexec/atrun
diff options
context:
space:
mode:
authorsjg <sjg@FreeBSD.org>2013-09-05 20:18:59 +0000
committersjg <sjg@FreeBSD.org>2013-09-05 20:18:59 +0000
commit62bb1062226d3ce6a2350808256a25508978352d (patch)
tree22b131dceb13c3df96da594fbaadb693504797c7 /libexec/atrun
parent72ab90509b3a51ab361bf710338f2ef44a4e360d (diff)
parent04932445481c2cb89ff69a83b961bdef3d64757e (diff)
downloadFreeBSD-src-62bb1062226d3ce6a2350808256a25508978352d.zip
FreeBSD-src-62bb1062226d3ce6a2350808256a25508978352d.tar.gz
Merge from head
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 8b0315e..594107e 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;
OpenPOWER on IntegriCloud