]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[bug 3432] backport to 4.2.8-p15
authorJuergen Perlinger <perlinger@ntp.org>
Sun, 25 Oct 2020 07:43:17 +0000 (08:43 +0100)
committerJuergen Perlinger <perlinger@ntp.org>
Sun, 25 Oct 2020 07:43:17 +0000 (08:43 +0100)
 - check 'write' for daemon wait pipe

bk: 5f952c953LyvLA_9gJSWnltSvgzWvQ

ntpd/ntp_proto.c
ntpd/ntpd.c

index cde5a30852dd4150867fa23a200d5da1a8d984e9..898ff73eecdd41fac545e9e1f76892495582092b 100644 (file)
@@ -2947,7 +2947,8 @@ clock_update(
                         */
 #ifdef HAVE_WORKING_FORK
                        if (daemon_pipe[1] != -1) {
-                               write(daemon_pipe[1], "S\n", 2);
+                               if (2 != write(daemon_pipe[1], "S\n", 2))
+                                       msyslog(LOG_ERR, "ntpd: daemon failed to notify parent!");
                                close(daemon_pipe[1]);
                                daemon_pipe[1] = -1;
                                DPRINTF(1, ("notified parent --wait-sync is done\n"));
index eeb7a88fe5ad4833d8369087bd9c00f11124d701..ffe67694f1f37292671e8d203c37b15000d8d9e4 100644 (file)
@@ -1447,8 +1447,10 @@ int scmp_sc[] = {
 #if defined(SYS_WINNT)
        ntservice_isup();
 #elif defined(HAVE_WORKING_FORK)
-       if (daemon_pipe[1] != -1) {
-               write(daemon_pipe[1], "R\n", 2);
+       if ((daemon_pipe[1] != -1) && (2 != write(daemon_pipe[1], "R\n", 2))) {
+               msyslog(LOG_ERR, "ntpd: daemon failed to notify parent!");
+               close(daemon_pipe[1]);
+               daemon_pipe[1] = -1;
        }
 #endif /* HAVE_WORKING_FORK */