|
|
@ -1,4 +1,4 @@ |
|
|
|
From 3abcf742a75a14d89f7cbea12acb4300f16c51fb Mon Sep 17 00:00:00 2001 |
|
|
|
From 4ee694f478d89cf572546f761c9ef454ec10402a 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/13] add -p option to create a pid file |
|
|
@ -13,7 +13,7 @@ Origin: https://bugs.gentoo.org/show_bug.cgi?id=493082 |
|
|
|
3 files changed, 33 insertions(+), 5 deletions(-) |
|
|
|
|
|
|
|
diff --git a/src/usr.sbin/ntpd/ntpd.8 b/src/usr.sbin/ntpd/ntpd.8
|
|
|
|
index dcfb6d2..1b885a1 100644
|
|
|
|
index dcfb6d243..1b885a13d 100644
|
|
|
|
--- a/src/usr.sbin/ntpd/ntpd.8
|
|
|
|
+++ b/src/usr.sbin/ntpd/ntpd.8
|
|
|
|
@@ -25,6 +25,7 @@
|
|
|
@ -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 aac5e23..463600a 100644
|
|
|
|
index 1750b8cf5..8e47e2403 100644
|
|
|
|
--- a/src/usr.sbin/ntpd/ntpd.c
|
|
|
|
+++ b/src/usr.sbin/ntpd/ntpd.c
|
|
|
|
@@ -87,6 +87,18 @@ sighdlr(int sig)
|
|
|
@ -66,16 +66,16 @@ index aac5e23..463600a 100644 |
|
|
|
__progname); |
|
|
|
exit(1); |
|
|
|
} |
|
|
|
@@ -135,7 +147,7 @@ main(int argc, char *argv[])
|
|
|
|
@@ -132,7 +144,7 @@ main(int argc, char *argv[])
|
|
|
|
|
|
|
|
memset(&lconf, 0, sizeof(lconf)); |
|
|
|
|
|
|
|
- while ((ch = getopt(argc, argv, "df:nP:sSv")) != -1) {
|
|
|
|
+ while ((ch = getopt(argc, argv, "df:nP:p:sSv")) != -1) {
|
|
|
|
+ while ((ch = getopt(argc, argv, "df:np:P:sSv")) != -1) {
|
|
|
|
switch (ch) { |
|
|
|
case 'd': |
|
|
|
lconf.debug = 2; |
|
|
|
@@ -150,6 +162,9 @@ main(int argc, char *argv[])
|
|
|
|
@@ -147,6 +159,9 @@ main(int argc, char *argv[])
|
|
|
|
case 'P': |
|
|
|
pname = optarg; |
|
|
|
break; |
|
|
@ -85,10 +85,10 @@ index aac5e23..463600a 100644 |
|
|
|
case 's': |
|
|
|
lconf.settime = 1; |
|
|
|
break; |
|
|
|
@@ -217,9 +232,11 @@ main(int argc, char *argv[])
|
|
|
|
@@ -210,9 +225,11 @@ main(int argc, char *argv[])
|
|
|
|
if (!lconf.settime) { |
|
|
|
log_init(lconf.debug, LOG_DAEMON); |
|
|
|
log_verbose(lconf.verbose); |
|
|
|
log_setverbose(lconf.verbose); |
|
|
|
- if (!lconf.debug)
|
|
|
|
+ if (!lconf.debug) {
|
|
|
|
if (daemon(1, 0)) |
|
|
@ -98,8 +98,8 @@ index aac5e23..463600a 100644 |
|
|
|
} else |
|
|
|
timeout = SETTIME_TIMEOUT * 1000; |
|
|
|
|
|
|
|
@@ -294,9 +311,11 @@ main(int argc, char *argv[])
|
|
|
|
log_verbose(lconf.verbose); |
|
|
|
@@ -287,9 +304,11 @@ main(int argc, char *argv[])
|
|
|
|
log_setverbose(lconf.verbose); |
|
|
|
log_warnx("no reply received in time, skipping initial " |
|
|
|
"time setting"); |
|
|
|
- if (!lconf.debug)
|
|
|
@ -111,7 +111,7 @@ index aac5e23..463600a 100644 |
|
|
|
} |
|
|
|
|
|
|
|
if (nfds > 0 && (pfd[PFD_PIPE].revents & POLLOUT)) |
|
|
|
@@ -335,6 +354,8 @@ main(int argc, char *argv[])
|
|
|
|
@@ -328,6 +347,8 @@ main(int argc, char *argv[])
|
|
|
|
msgbuf_clear(&ibuf->w); |
|
|
|
free(ibuf); |
|
|
|
log_info("Terminating"); |
|
|
@ -120,7 +120,7 @@ index aac5e23..463600a 100644 |
|
|
|
return (0); |
|
|
|
} |
|
|
|
|
|
|
|
@@ -395,9 +416,11 @@ dispatch_imsg(struct ntpd_conf *lconf, int argc, char **argv)
|
|
|
|
@@ -388,9 +409,11 @@ dispatch_imsg(struct ntpd_conf *lconf, int argc, char **argv)
|
|
|
|
memcpy(&d, imsg.data, sizeof(d)); |
|
|
|
ntpd_settime(d); |
|
|
|
/* daemonize now */ |
|
|
@ -134,7 +134,7 @@ index aac5e23..463600a 100644 |
|
|
|
timeout = INFTIM; |
|
|
|
break; |
|
|
|
diff --git a/src/usr.sbin/ntpd/ntpd.h b/src/usr.sbin/ntpd/ntpd.h
|
|
|
|
index f80e23c..fcca519 100644
|
|
|
|
index a123d1bfc..6e693661c 100644
|
|
|
|
--- a/src/usr.sbin/ntpd/ntpd.h
|
|
|
|
+++ b/src/usr.sbin/ntpd/ntpd.h
|
|
|
|
@@ -249,6 +249,7 @@ struct ntpd_conf {
|
|
|
@ -146,5 +146,5 @@ index f80e23c..fcca519 100644 |
|
|
|
|
|
|
|
struct ctl_show_status { |
|
|
|
--
|
|
|
|
2.10.1 |
|
|
|
2.11.0 |
|
|
|
|