|
From e600fb2d0a4423ecad5d3961b51fb55b70889918 Mon Sep 17 00:00:00 2001
|
|
From: Brent Cook <busterb@gmail.com>
|
|
Date: Wed, 31 Dec 2014 08:31:20 -0600
|
|
Subject: [PATCH 04/11] Fix DNS timeout lookup
|
|
|
|
Author: Paul B. Henson <henson@acm.org>
|
|
Origin: https://bugs.gentoo.org/show_bug.cgi?id=493358
|
|
---
|
|
src/usr.sbin/ntpd/ntpd.c | 6 +++++-
|
|
1 file changed, 5 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/usr.sbin/ntpd/ntpd.c b/src/usr.sbin/ntpd/ntpd.c
|
|
index cfc7e56..9ce169c 100644
|
|
--- a/src/usr.sbin/ntpd/ntpd.c
|
|
+++ b/src/usr.sbin/ntpd/ntpd.c
|
|
@@ -110,6 +110,7 @@ main(int argc, char *argv[])
|
|
int pipe_chld[2];
|
|
struct passwd *pw;
|
|
extern char *__progname;
|
|
+ time_t start_time;
|
|
|
|
if (strcmp(__progname, "ntpctl") == 0) {
|
|
ctl_main (argc, argv);
|
|
@@ -205,6 +206,8 @@ main(int argc, char *argv[])
|
|
fatal(NULL);
|
|
imsg_init(ibuf, pipe_chld[0]);
|
|
|
|
+ start_time = getmonotime();
|
|
+
|
|
while (quit == 0) {
|
|
pfd[PFD_PIPE].fd = ibuf->fd;
|
|
pfd[PFD_PIPE].events = POLLIN;
|
|
@@ -217,7 +220,8 @@ main(int argc, char *argv[])
|
|
quit = 1;
|
|
}
|
|
|
|
- if (nfds == 0 && lconf.settime) {
|
|
+ if (lconf.settime &&
|
|
+ (nfds == 0 || getmonotime() > start_time + SETTIME_TIMEOUT)) {
|
|
lconf.settime = 0;
|
|
timeout = INFTIM;
|
|
log_init(lconf.debug);
|
|
--
|
|
1.9.1
|
|
|