+* [Bug 1732] ntpd ties up CPU on disconnected USB device.
(4.2.7p90) 2010/12/06 Released by Harlan Stenn <stenn@ntp.org>
* [Bug 1738] Windows ntpd has wrong net adapter name.
* [Bug 1740] ntpdc -c reslist packet count wrongly treated as signed.
*/
if (n < 0) {
int err = errno;
+ int j, b, prior;
/*
* extended FAU debugging output
*/
"select(%d, %s, 0L, 0L, &0.0) error: %m",
maxactivefd + 1,
fdbits(maxactivefd, &activefds));
- if (err == EBADF) {
- int j, b;
- fds = activefds;
- for (j = 0; j <= maxactivefd; j++)
- if ((FD_ISSET(j, &fds)
- && (read(j, &b, 0) == -1)))
- msyslog(LOG_ERR,
- "Bad file descriptor %d",
- j);
+ if (err != EBADF)
+ return;
+ for (j = 0, prior = 0; j <= maxactivefd; j++) {
+ if (FD_ISSET(j, &activefds)) {
+ if (-1 != read(j, &b, 0)) {
+ prior = j;
+ continue;
+ }
+ msyslog(LOG_ERR,
+ "Removing bad file descriptor %d from select set",
+ j);
+ FD_CLR(j, &activefds);
+ if (j == maxactivefd)
+ maxactivefd = prior;
+ }
}
return;
}