summaryrefslogtreecommitdiffstats
path: root/usr.sbin/autofs
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2014-10-16 08:33:04 +0000
committertrasz <trasz@FreeBSD.org>2014-10-16 08:33:04 +0000
commit8859689d4db61282a3b10741c8689bec8824095d (patch)
treeb9077f2af3554418ab0c857ea6513dddc0ef6fdf /usr.sbin/autofs
parentbfe82e3333e595f6baa99b9cd7f81f9a2c0361e2 (diff)
downloadFreeBSD-src-8859689d4db61282a3b10741c8689bec8824095d.zip
FreeBSD-src-8859689d4db61282a3b10741c8689bec8824095d.tar.gz
Fix automountd(8) not to leave zombies.
MFC after: 1 month Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'usr.sbin/autofs')
-rw-r--r--usr.sbin/autofs/automountd.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/usr.sbin/autofs/automountd.c b/usr.sbin/autofs/automountd.c
index 0a648c5..44143e5 100644
--- a/usr.sbin/autofs/automountd.c
+++ b/usr.sbin/autofs/automountd.c
@@ -364,6 +364,33 @@ handle_request(const struct autofs_daemon_request *adr, char *cmdline_options,
quick_exit(0);
}
+static void
+sigchld_handler(int dummy __unused)
+{
+
+ /*
+ * The only purpose of this handler is to make SIGCHLD
+ * interrupt the AUTOFSREQUEST ioctl(2), so we can call
+ * wait_for_children().
+ */
+}
+
+static void
+register_sigchld(void)
+{
+ struct sigaction sa;
+ int error;
+
+ bzero(&sa, sizeof(sa));
+ sa.sa_handler = sigchld_handler;
+ sigfillset(&sa.sa_mask);
+ error = sigaction(SIGCHLD, &sa, NULL);
+ if (error != 0)
+ log_err(1, "sigaction");
+
+}
+
+
static int
wait_for_children(bool block)
{
@@ -496,6 +523,8 @@ main_automountd(int argc, char **argv)
pidfile_write(pidfh);
+ register_sigchld();
+
for (;;) {
log_debugx("waiting for request from the kernel");
OpenPOWER on IntegriCloud