svn commit: r273160 - head/usr.sbin/autofs

Edward Tomasz Napierala trasz at FreeBSD.org
Thu Oct 16 08:33:05 UTC 2014


Author: trasz
Date: Thu Oct 16 08:33:04 2014
New Revision: 273160
URL: https://svnweb.freebsd.org/changeset/base/273160

Log:
  Fix automountd(8) not to leave zombies.
  
  MFC after:	1 month
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/usr.sbin/autofs/automountd.c

Modified: head/usr.sbin/autofs/automountd.c
==============================================================================
--- head/usr.sbin/autofs/automountd.c	Thu Oct 16 02:24:19 2014	(r273159)
+++ head/usr.sbin/autofs/automountd.c	Thu Oct 16 08:33:04 2014	(r273160)
@@ -364,6 +364,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)
 {
@@ -496,6 +523,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-head mailing list