summaryrefslogtreecommitdiffstats
path: root/usr.sbin/autofs
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2014-11-15 05:53:45 +0000
committertrasz <trasz@FreeBSD.org>2014-11-15 05:53:45 +0000
commit131ee6d96ee7de1bb7a9ece242f292368670ab2d (patch)
treebcf94870b5f12991363dd518cd3f86834cc9a2c7 /usr.sbin/autofs
parent93accf39994e57a88e68bf56cbc5ed2d2cf7d84b (diff)
downloadFreeBSD-src-131ee6d96ee7de1bb7a9ece242f292368670ab2d.zip
FreeBSD-src-131ee6d96ee7de1bb7a9ece242f292368670ab2d.tar.gz
MFC r273160:
Fix automountd(8) not to leave zombies. 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 7c40b6b..374e901 100644
--- a/usr.sbin/autofs/automountd.c
+++ b/usr.sbin/autofs/automountd.c
@@ -345,6 +345,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)
{
@@ -477,6 +504,8 @@ main_automountd(int argc, char **argv)
pidfile_write(pidfh);
+ register_sigchld();
+
for (;;) {
log_debugx("waiting for request from the kernel");
OpenPOWER on IntegriCloud