1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-17 10:26:15 +00:00

Fix automountd(8) not to leave zombies.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Edward Tomasz Napierala 2014-10-16 08:33:04 +00:00
parent 3dd6b7ff3d
commit 75afaef266
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=273160

View File

@ -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");