summaryrefslogtreecommitdiff
path: root/usr.sbin/cron/atrun.c
diff options
context:
space:
mode:
authorJeremie Courreges-Anglas <jca@cvs.openbsd.org>2017-10-23 15:15:23 +0000
committerJeremie Courreges-Anglas <jca@cvs.openbsd.org>2017-10-23 15:15:23 +0000
commit427b3e34a2cf05064f11372bc41ba1d72687f291 (patch)
tree86ada348bf0d50b0e88908a5b345ef092b148dd6 /usr.sbin/cron/atrun.c
parent8dfafb1a51ce47117fce58dfa86068454c0dd324 (diff)
Close the socket (and dfd) in at(1) child processes
Fixes a failure at restart if a child process still has the socket opened. Spotted by millert@, ok friehm@ millert@
Diffstat (limited to 'usr.sbin/cron/atrun.c')
-rw-r--r--usr.sbin/cron/atrun.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.sbin/cron/atrun.c b/usr.sbin/cron/atrun.c
index 6f08809a341..bc2e3098bad 100644
--- a/usr.sbin/cron/atrun.c
+++ b/usr.sbin/cron/atrun.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: atrun.c,v 1.46 2017/06/08 16:23:39 millert Exp $ */
+/* $OpenBSD: atrun.c,v 1.47 2017/10/23 15:15:22 jca Exp $ */
/*
* Copyright (c) 2002-2003 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -283,6 +283,10 @@ run_job(const atjob *job, int dfd, const char *atfile)
return;
}
+ /* Close fds opened by the parent. */
+ close(cronSock);
+ close(dfd);
+
/*
* We don't want the main cron daemon to wait for our children--
* we will do it ourselves via waitpid().