Portable build framework for OpenNTPD
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

45 lines
1.2 KiB

From 6f091765d6ee996ad679868deb7f196c240c314e Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
Date: Wed, 31 Dec 2014 08:31:20 -0600
Subject: [PATCH 11/12] 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 2d5809c..b45f4ca 100644
--- a/src/usr.sbin/ntpd/ntpd.c
+++ b/src/usr.sbin/ntpd/ntpd.c
@@ -123,6 +123,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);
@@ -222,6 +223,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;
@@ -234,7 +237,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