summaryrefslogtreecommitdiffstats
path: root/libexec
diff options
context:
space:
mode:
authorghelmer <ghelmer@FreeBSD.org>2014-05-05 16:52:38 +0000
committerghelmer <ghelmer@FreeBSD.org>2014-05-05 16:52:38 +0000
commit037558ada74571fd98b5c52aba933c57224ce1b1 (patch)
treeea8401d34843504479cf865b6e710015136f1c6c /libexec
parent9fe5eca952a101650cad59dd5bb5256c130c962d (diff)
downloadFreeBSD-src-037558ada74571fd98b5c52aba933c57224ce1b1.zip
FreeBSD-src-037558ada74571fd98b5c52aba933c57224ce1b1.tar.gz
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
Diffstat (limited to 'libexec')
-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