Permalink
Browse files

Rework the patch a little to not spit out the wrong message when actu…

…ally time is synched. Helps on ticket #2307
  • Loading branch information...
1 parent a620a17 commit 2ac61f8c815740ea955a012d36eaabe6699c7b92 Ermal committed Apr 11, 2012
Showing with 35 additions and 18 deletions.
  1. +35 −18 pfPorts/openntpd/files/patch-wlast
@@ -1,6 +1,6 @@
-diff -ur ../ntpd.old/log.c ./log.c
---- ../ntpd.old/log.c 2012-03-01 22:10:50.000000000 +0000
-+++ ./log.c 2012-03-01 22:14:55.000000000 +0000
+diff -ur ../ntpd.orig/log.c ./log.c
+--- ../ntpd.orig/log.c 2012-04-11 19:36:59.000000000 +0000
++++ ./log.c 2012-04-11 19:37:12.000000000 +0000
@@ -42,7 +42,7 @@
debug = n_debug;
@@ -21,9 +21,9 @@ diff -ur ../ntpd.old/log.c ./log.c
vsyslog(pri, fmt, ap);
}
-diff -ur ../ntpd.old/ntpd.c ./ntpd.c
---- ../ntpd.old/ntpd.c 2012-03-01 22:10:50.000000000 +0000
-+++ ./ntpd.c 2012-03-01 22:13:41.000000000 +0000
+diff -ur ../ntpd.orig/ntpd.c ./ntpd.c
+--- ../ntpd.orig/ntpd.c 2012-04-11 19:36:59.000000000 +0000
++++ ./ntpd.c 2012-04-11 19:42:08.000000000 +0000
@@ -144,6 +144,7 @@
if ((pw = getpwnam(NTPD_USER)) == NULL)
errx(1, "unknown user %s", NTPD_USER);
@@ -32,26 +32,43 @@ diff -ur ../ntpd.old/ntpd.c ./ntpd.c
reset_adjtime();
if (!lconf.settime) {
log_init(lconf.debug);
-@@ -185,15 +186,17 @@
+@@ -185,17 +186,6 @@
quit = 1;
}
- if (nfds == 0 && lconf.settime) {
-+ if (lconf.settime) {
- lconf.settime = 0;
- timeout = INFTIM;
+- lconf.settime = 0;
+- timeout = INFTIM;
- log_init(lconf.debug);
+- log_debug("no reply received in time, skipping initial "
+- "time setting");
+- if (!lconf.debug)
+- if (daemon(1, 0))
+- fatal("daemon");
+- }
+-
+ if (nfds > 0 && (pfd[PFD_PIPE].revents & POLLOUT))
+ if (msgbuf_write(&ibuf->w) < 0) {
+ log_warn("pipe write error (to child)");
+@@ -208,6 +198,21 @@
+ quit = 1;
+ }
+
++ if (lconf.settime) {
++ lconf.settime = 0;
++ timeout = INFTIM;
+ signal(SIGCHLD, SIG_DFL);
+ if (chld_pid)
+ kill(chld_pid, SIGTERM);
+ msgbuf_clear(&ibuf->w);
++ close(pipe_chld[0]);
+ free(ibuf);
- log_debug("no reply received in time, skipping initial "
- "time setting");
-- if (!lconf.debug)
-- if (daemon(1, 0))
-- fatal("daemon");
++ if (nfds == 0)
++ log_debug("no reply received in time, skipping initial "
++ "time setting");
+ goto reinit;
- }
-
- if (nfds > 0 && (pfd[PFD_PIPE].revents & POLLOUT))
++ }
++
+ if (sigchld) {
+ if (check_child(chld_pid, "child")) {
+ quit = 1;

0 comments on commit 2ac61f8

Please sign in to comment.