|
|
@ -1,4 +1,4 @@ |
|
|
|
From 4eaf878371b6a3bcba24fcf6ece12a6170d7d983 Mon Sep 17 00:00:00 2001 |
|
|
|
From 04896536acf7a0305de2397afe4f86d3bbf66df7 Mon Sep 17 00:00:00 2001 |
|
|
|
From: Brent Cook <busterb@gmail.com> |
|
|
|
Date: Wed, 31 Dec 2014 08:26:41 -0600 |
|
|
|
Subject: [PATCH 07/12] add -p option to create a pid file |
|
|
@ -8,9 +8,9 @@ This is used in both the Gentoo and Debian ports. |
|
|
|
Origin: https://bugs.gentoo.org/show_bug.cgi?id=493082 |
|
|
|
---
|
|
|
|
src/usr.sbin/ntpd/ntpd.8 | 4 ++++ |
|
|
|
src/usr.sbin/ntpd/ntpd.c | 33 ++++++++++++++++++++++++++++----- |
|
|
|
src/usr.sbin/ntpd/ntpd.c | 35 +++++++++++++++++++++++++++++------ |
|
|
|
src/usr.sbin/ntpd/ntpd.h | 1 + |
|
|
|
3 files changed, 33 insertions(+), 5 deletions(-) |
|
|
|
3 files changed, 34 insertions(+), 6 deletions(-) |
|
|
|
|
|
|
|
diff --git a/src/usr.sbin/ntpd/ntpd.8 b/src/usr.sbin/ntpd/ntpd.8
|
|
|
|
index dcfb6d2..1b885a1 100644
|
|
|
@ -35,7 +35,7 @@ index dcfb6d2..1b885a1 100644 |
|
|
|
Do not set the time immediately at startup. |
|
|
|
This is the default. |
|
|
|
diff --git a/src/usr.sbin/ntpd/ntpd.c b/src/usr.sbin/ntpd/ntpd.c
|
|
|
|
index b6eb98e..8dbd51e 100644
|
|
|
|
index 43486f0..f8727f6 100644
|
|
|
|
--- a/src/usr.sbin/ntpd/ntpd.c
|
|
|
|
+++ b/src/usr.sbin/ntpd/ntpd.c
|
|
|
|
@@ -87,6 +87,18 @@ sighdlr(int sig)
|
|
|
@ -93,12 +93,21 @@ index b6eb98e..8dbd51e 100644 |
|
|
|
+ if (!lconf.debug) {
|
|
|
|
if (daemon(1, 0)) |
|
|
|
fatal("daemon"); |
|
|
|
+ writepid(&lconf);
|
|
|
|
+ }
|
|
|
|
+ writepid(&lconf);
|
|
|
|
} else |
|
|
|
timeout = SETTIME_TIMEOUT * 1000; |
|
|
|
|
|
|
|
@@ -273,9 +290,11 @@ main(int argc, char *argv[])
|
|
|
|
@@ -230,7 +247,7 @@ main(int argc, char *argv[])
|
|
|
|
* Constraint processes are forked with certificates in memory, |
|
|
|
* then privdrop into chroot before speaking to the outside world. |
|
|
|
*/ |
|
|
|
-#if 0
|
|
|
|
+#if 0
|
|
|
|
if (pledge("stdio rpath inet settime proc id", NULL) == -1) |
|
|
|
err(1, "pledge"); |
|
|
|
#endif |
|
|
|
@@ -275,9 +292,11 @@ main(int argc, char *argv[])
|
|
|
|
log_verbose(lconf.verbose); |
|
|
|
log_warnx("no reply received in time, skipping initial " |
|
|
|
"time setting"); |
|
|
@ -111,7 +120,7 @@ index b6eb98e..8dbd51e 100644 |
|
|
|
} |
|
|
|
|
|
|
|
if (nfds > 0 && (pfd[PFD_PIPE].revents & POLLOUT)) |
|
|
|
@@ -318,6 +337,8 @@ main(int argc, char *argv[])
|
|
|
|
@@ -320,6 +339,8 @@ main(int argc, char *argv[])
|
|
|
|
msgbuf_clear(&ibuf->w); |
|
|
|
free(ibuf); |
|
|
|
log_info("Terminating"); |
|
|
@ -120,7 +129,7 @@ index b6eb98e..8dbd51e 100644 |
|
|
|
return (0); |
|
|
|
} |
|
|
|
|
|
|
|
@@ -401,9 +422,11 @@ dispatch_imsg(struct ntpd_conf *lconf, const char *pw_dir,
|
|
|
|
@@ -403,9 +424,11 @@ dispatch_imsg(struct ntpd_conf *lconf, const char *pw_dir,
|
|
|
|
memcpy(&d, imsg.data, sizeof(d)); |
|
|
|
ntpd_settime(d); |
|
|
|
/* daemonize now */ |
|
|
@ -134,10 +143,10 @@ index b6eb98e..8dbd51e 100644 |
|
|
|
timeout = INFTIM; |
|
|
|
break; |
|
|
|
diff --git a/src/usr.sbin/ntpd/ntpd.h b/src/usr.sbin/ntpd/ntpd.h
|
|
|
|
index dfcaf33..24a3222 100644
|
|
|
|
index 9ee2e42..d39628c 100644
|
|
|
|
--- a/src/usr.sbin/ntpd/ntpd.h
|
|
|
|
+++ b/src/usr.sbin/ntpd/ntpd.h
|
|
|
|
@@ -243,6 +243,7 @@ struct ntpd_conf {
|
|
|
|
@@ -237,6 +237,7 @@ struct ntpd_conf {
|
|
|
|
u_int constraint_errors; |
|
|
|
u_int8_t *ca; |
|
|
|
size_t ca_len; |
|
|
@ -146,5 +155,5 @@ index dfcaf33..24a3222 100644 |
|
|
|
|
|
|
|
struct ctl_show_status { |
|
|
|
--
|
|
|
|
2.7.0 |
|
|
|
2.8.1 |
|
|
|
|