From b3c2b2c8c9c4e59ad3518d10d3765cf35934d76c Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Wed, 31 Dec 2014 08:31:20 -0600 Subject: [PATCH 09/16] Fix DNS timeout lookup Author: Paul B. Henson 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 d764a50..3622a13 100644 --- a/src/usr.sbin/ntpd/ntpd.c +++ b/src/usr.sbin/ntpd/ntpd.c @@ -111,6 +111,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