Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Nov 2014 05:53:46 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r274548 - stable/10/usr.sbin/autofs
Message-ID:  <201411150553.sAF5rkbT003959@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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");
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201411150553.sAF5rkbT003959>