From 431920cccf144a4448f64fd5a5879e5a5b83a1bf Mon Sep 17 00:00:00 2001 From: henning <> Date: Sat, 21 Oct 2006 07:30:58 +0000 Subject: [PATCH] Found that even if client fd (i.e to NTP source) is set to -1 because of error, it may still participate in poll() causing poll() to repeatedly wake up on error fd. so make sure w edon't add -1 fds to pollevents to avoid unnecessary wakeups From: amandal@entrisphere.com --- src/usr.sbin/ntpd/ntp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/usr.sbin/ntpd/ntp.c b/src/usr.sbin/ntpd/ntp.c index be0c4fda..aafba9aa 100644 --- a/src/usr.sbin/ntpd/ntp.c +++ b/src/usr.sbin/ntpd/ntp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ntp.c,v 1.91 2006/07/01 18:52:46 otto Exp $ */ +/* $OpenBSD: ntp.c,v 1.92 2006/10/21 07:30:58 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -243,7 +243,8 @@ ntp_main(int pipe_prnt[2], struct ntpd_conf *nconf) set_next(p, timeout); } - if (p->state == STATE_QUERY_SENT) { + if (p->state == STATE_QUERY_SENT && + p->query->fd != -1) { pfd[i].fd = p->query->fd; pfd[i].events = POLLIN; idx2peer[i - idx_peers] = p;