Wait for the asynchronous dns resolver child to be done (and close the

socket descriptors) before returning. Otherwise we might get bind errors.
Reported by kim@, fixed by mlelstv@.
This commit is contained in:
christos 2020-10-10 13:41:14 +00:00
parent df11da68ff
commit b65092432b

View File

@ -1,4 +1,4 @@
/* $NetBSD: work_fork.c,v 1.14 2020/05/25 20:47:24 christos Exp $ */
/* $NetBSD: work_fork.c,v 1.15 2020/10/10 13:41:14 christos Exp $ */
/*
* work_fork.c - fork implementation for blocking worker child.
@ -559,6 +559,9 @@ fork_blocking_child(
/* wire into I/O loop */
(*addremove_io_fd)(c->resp_read_pipe, is_pipe, FALSE);
/* wait until child is done */
rc = netread(c->resp_read_pipe, &rc, sizeof(rc));
return; /* parent returns */
}
@ -585,6 +588,10 @@ fork_blocking_child(
c->resp_write_pipe = blocking_pipes[3];
kill_asyncio(0);
/* Tell parent we are ready */
rc = netwrite(c->resp_write_pipe, &rc, sizeof(rc));
closelog();
if (syslog_file != NULL) {
fclose(syslog_file);