svn commit: r274548 - stable/10/usr.sbin/autofs
Edward Tomasz Napierala
trasz at FreeBSD.org
Sat Nov 15 05:53:46 UTC 2014
Author: trasz
Date: Sat Nov 15 05:53:45 2014
New Revision: 274548
URL: https://svnweb.freebsd.org/changeset/base/274548
Log:
MFC r273160:
Fix automountd(8) not to leave zombies.
Sponsored by: The FreeBSD Foundation
Modified:
stable/10/usr.sbin/autofs/automountd.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/usr.sbin/autofs/automountd.c
==============================================================================
--- stable/10/usr.sbin/autofs/automountd.c Sat Nov 15 05:50:27 2014 (r274547)
+++ stable/10/usr.sbin/autofs/automountd.c Sat Nov 15 05:53:45 2014 (r274548)
@@ -345,6 +345,33 @@ handle_request(const struct autofs_daemo
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");
More information about the svn-src-stable
mailing list