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

  1. From b3c2b2c8c9c4e59ad3518d10d3765cf35934d76c Mon Sep 17 00:00:00 2001
  2. From: Brent Cook <busterb@gmail.com>
  3. Date: Wed, 31 Dec 2014 08:31:20 -0600
  4. Subject: [PATCH 09/16] Fix DNS timeout lookup
  5. Author: Paul B. Henson <henson@acm.org>
  6. Origin: https://bugs.gentoo.org/show_bug.cgi?id=493358
  7. ---
  8. src/usr.sbin/ntpd/ntpd.c | 6 +++++-
  9. 1 file changed, 5 insertions(+), 1 deletion(-)
  10. diff --git a/src/usr.sbin/ntpd/ntpd.c b/src/usr.sbin/ntpd/ntpd.c
  11. index d764a50..3622a13 100644
  12. --- a/src/usr.sbin/ntpd/ntpd.c
  13. +++ b/src/usr.sbin/ntpd/ntpd.c
  14. @@ -111,6 +111,7 @@ main(int argc, char *argv[])
  15. int pipe_chld[2];
  16. struct passwd *pw;
  17. extern char *__progname;
  18. + time_t start_time;
  19. if (strcmp(__progname, "ntpctl") == 0) {
  20. ctl_main (argc, argv);
  21. @@ -205,6 +206,8 @@ main(int argc, char *argv[])
  22. fatal(NULL);
  23. imsg_init(ibuf, pipe_chld[0]);
  24. + start_time = getmonotime();
  25. +
  26. while (quit == 0) {
  27. pfd[PFD_PIPE].fd = ibuf->fd;
  28. pfd[PFD_PIPE].events = POLLIN;
  29. @@ -217,7 +220,8 @@ main(int argc, char *argv[])
  30. quit = 1;
  31. }
  32. - if (nfds == 0 && lconf.settime) {
  33. + if (lconf.settime &&
  34. + (nfds == 0 || getmonotime() > start_time + SETTIME_TIMEOUT)) {
  35. lconf.settime = 0;
  36. timeout = INFTIM;
  37. log_init(lconf.debug);
  38. --
  39. 1.9.1