From 037558ada74571fd98b5c52aba933c57224ce1b1 Mon Sep 17 00:00:00 2001 From: ghelmer Date: Mon, 5 May 2014 16:52:38 +0000 Subject: MFC r264617: 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. Submitted by: J.R. Oldroyd jr at opal.com --- libexec/atrun/atrun.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'libexec') 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); } -- cgit v1.1