summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorghelmer <ghelmer@FreeBSD.org>2014-04-17 16:00:26 +0000
committerghelmer <ghelmer@FreeBSD.org>2014-04-17 16:00:26 +0000
commit20f44825dbd5a1d118d3867d08affeaa909d81be (patch)
tree9d7c660bafc2ad6d97fb0bd0541cf328b8db65bf
parent43701d46452c13166d38cc2d51e329bf58df5d95 (diff)
downloadFreeBSD-src-20f44825dbd5a1d118d3867d08affeaa909d81be.zip
FreeBSD-src-20f44825dbd5a1d118d3867d08affeaa909d81be.tar.gz
Fix releasing the lock in the parent atrun process after the queue
directory has been processed. Otherwise, a long-running child process caused other atrun invocations to stall unnecessarily.
-rw-r--r--libexec/atrun/atrun.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libexec/atrun/atrun.c b/libexec/atrun/atrun.c
index 594107e..1e25766 100644
--- a/libexec/atrun/atrun.c
+++ b/libexec/atrun/atrun.c
@@ -567,6 +567,12 @@ main(int argc, char *argv[])
if (run_batch && (gloadavg() < load_avg))
run_file(batch_name, batch_uid, batch_gid);
+ if (flock(dirfd(spool), LOCK_UN) == -1)
+ perr("cannot unlock %s", ATJOB_DIR);
+
+ if (closedir(spool) == -1)
+ perr("cannot closedir %s", ATJOB_DIR);
+
closelog();
exit(EXIT_SUCCESS);
}
OpenPOWER on IntegriCloud