FreeBSD/contrib/ntp/ntpd/ntp_io.c
/*
 * Try to sanitize the global FD set
 *
 * SIGNAL HANDLER CONTEXT if HAVE_SIGNALED_IO, ordinary userspace otherwise
 */
Try to sanitize the global FD set
SIGNAL HANDLER CONTEXT if HAVE_SIGNALED_IO, ordinary userspace otherwise
Try to sanitize the global FD set SIGNAL HANDLER CONTEXT if HAVE_SIGNALED_IO ordinary userspace otherwise
static int
sanitize_fdset(
	int	errc
	)
{
	int j, b, maxscan;
#  ifndef HAVE_SIGNALED_IO
	if (errc != EINTR) {
		msyslog(LOG_ERR,
			"select(%d, %s, 0L, 0L, &0.0) error: %m",
			maxactivefd + 1,
			fdbits(maxactivefd, &activefds));
	}
#   endif
	if (errc != EBADF)
		return FALSE;
	for (j = 0, maxscan = 0; j <= maxactivefd; j++) {
		if (FD_ISSET(j, &activefds)) {
			if (-1 != read(j, &b, 0)) {
				maxscan = j;
				continue;
			}
#		    ifndef HAVE_SIGNALED_IO
			msyslog(LOG_ERR,
				"Removing bad file descriptor %d from select set",
				j);
#		    endif
			FD_CLR(j, &activefds);
		}
	}
	if (maxactivefd != maxscan)
		maxactivefd = maxscan;
	return TRUE;
}
static int sanitize_fdset ( int errc ) { int j , b , maxscan ; #  ifndef HAVE_SIGNALED_IO if ( errc != EINTR ) { msyslog ( LOG_ERR , " " , maxactivefd + 1 , fdbits ( maxactivefd , & activefds ) ) ; } #   endif if ( errc != EBADF ) return FALSE ; for ( j = 0 , maxscan = 0 ; j <= maxactivefd ; j ++ ) { if ( FD_ISSET ( j , & activefds ) ) { if ( -1 != read ( j , & b , 0 ) ) { maxscan = j ; continue ; } #		    ifndef HAVE_SIGNALED_IO msyslog ( LOG_ERR , " " , j ) ; #		    endif FD_CLR ( j , & activefds ) ; } } if ( maxactivefd != maxscan ) maxactivefd = maxscan ; return TRUE ; }
Try to sanitize the global FD set
 SIGNAL HANDLER CONTEXT if HAVE_SIGNALED_IO, ordinary userspace otherwise
Try to sanitize the global FD set SIGNAL HANDLER CONTEXT if HAVE_SIGNALED_IO ordinary userspace otherwise
/*BOOL*/ /*
	 * extended FAU debugging output
	 */ /* if we have oviously bad FDs, try to sanitize the FD set. */