Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/ntp/dist/libntp Wait for the asynchronous dns r...



details:   https://anonhg.NetBSD.org/src/rev/5cfcc435f363
branches:  trunk
changeset: 976969:5cfcc435f363
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Oct 10 13:41:14 2020 +0000

description:
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@.

diffstat:

 external/bsd/ntp/dist/libntp/work_fork.c |  9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diffs (30 lines):

diff -r 25a4ea686a6e -r 5cfcc435f363 external/bsd/ntp/dist/libntp/work_fork.c
--- a/external/bsd/ntp/dist/libntp/work_fork.c  Sat Oct 10 12:57:39 2020 +0000
+++ b/external/bsd/ntp/dist/libntp/work_fork.c  Sat Oct 10 13:41:14 2020 +0000
@@ -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 @@
                /* 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 @@
        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);



Home | Main Index | Thread Index | Old Index