Projet

Général

Profil

« Précédent | Suivant » 

Révision 2ac61f8c

Ajouté par Ermal il y a environ 12 ans

Rework the patch a little to not spit out the wrong message when actually time is synched. Helps on ticket #2307

Voir les différences:

pfPorts/openntpd/files/patch-wlast
1
diff -ur ../ntpd.old/log.c ./log.c
2
--- ../ntpd.old/log.c	2012-03-01 22:10:50.000000000 +0000
3
+++ ./log.c	2012-03-01 22:14:55.000000000 +0000
1
diff -ur ../ntpd.orig/log.c ./log.c
2
--- ../ntpd.orig/log.c	2012-04-11 19:36:59.000000000 +0000
3
+++ ./log.c	2012-04-11 19:37:12.000000000 +0000
4 4
@@ -42,7 +42,7 @@
5 5
 
6 6
 	debug = n_debug;
......
21 21
 		vsyslog(pri, fmt, ap);
22 22
 }
23 23
 
24
diff -ur ../ntpd.old/ntpd.c ./ntpd.c
25
--- ../ntpd.old/ntpd.c	2012-03-01 22:10:50.000000000 +0000
26
+++ ./ntpd.c	2012-03-01 22:13:41.000000000 +0000
24
diff -ur ../ntpd.orig/ntpd.c ./ntpd.c
25
--- ../ntpd.orig/ntpd.c	2012-04-11 19:36:59.000000000 +0000
26
+++ ./ntpd.c	2012-04-11 19:42:08.000000000 +0000
27 27
@@ -144,6 +144,7 @@
28 28
 	if ((pw = getpwnam(NTPD_USER)) == NULL)
29 29
 		errx(1, "unknown user %s", NTPD_USER);
......
32 32
 	reset_adjtime();
33 33
 	if (!lconf.settime) {
34 34
 		log_init(lconf.debug);
35
@@ -185,15 +186,17 @@
35
@@ -185,17 +186,6 @@
36 36
 				quit = 1;
37 37
 			}
38 38
 
39 39
-		if (nfds == 0 && lconf.settime) {
40
+		if (lconf.settime) {
41
 			lconf.settime = 0;
42
 			timeout = INFTIM;
40
-			lconf.settime = 0;
41
-			timeout = INFTIM;
43 42
-			log_init(lconf.debug);
43
-			log_debug("no reply received in time, skipping initial "
44
-			    "time setting");
45
-			if (!lconf.debug)
46
-				if (daemon(1, 0))
47
-					fatal("daemon");
48
-		}
49
-
50
 		if (nfds > 0 && (pfd[PFD_PIPE].revents & POLLOUT))
51
 			if (msgbuf_write(&ibuf->w) < 0) {
52
 				log_warn("pipe write error (to child)");
53
@@ -208,6 +198,21 @@
54
 				quit = 1;
55
 		}
56
 
57
+		if (lconf.settime) {
58
+			lconf.settime = 0;
59
+			timeout = INFTIM;
44 60
+			signal(SIGCHLD, SIG_DFL);
45 61
+			if (chld_pid)
46 62
+				kill(chld_pid, SIGTERM);
47 63
+			msgbuf_clear(&ibuf->w);
64
+			close(pipe_chld[0]);
48 65
+			free(ibuf);
49
 			log_debug("no reply received in time, skipping initial "
50
 			    "time setting");
51
-			if (!lconf.debug)
52
-				if (daemon(1, 0))
53
-					fatal("daemon");
66
+			if (nfds == 0)
67
+				log_debug("no reply received in time, skipping initial "
68
+				    "time setting");
54 69
+			goto reinit;
55
 		}
56
 
57
 		if (nfds > 0 && (pfd[PFD_PIPE].revents & POLLOUT))
70
+		}
71
+
72
 		if (sigchld) {
73
 			if (check_child(chld_pid, "child")) {
74
 				quit = 1;

Formats disponibles : Unified diff