From: Danny Mayer Date: Tue, 16 May 2006 11:58:39 +0000 (-0400) Subject: Bug #614 Add FOPEN_MAX as a parameter for dup_fd() usage. Also this is the fix for... X-Git-Tag: NTP_4_2_1P253_RC~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0d7898fe9b061ca3bb83efd5a854e9ad26d9cccb;p=thirdparty%2Fntp.git Bug #614 Add FOPEN_MAX as a parameter for dup_fd() usage. Also this is the fix for Bug #530 bk: 4469be6fN83BAmowwSzqQ4Grmx-3OQ --- diff --git a/ntpd/ntp_io.c b/ntpd/ntp_io.c index c95a7c925..d122555bd 100644 --- a/ntpd/ntp_io.c +++ b/ntpd/ntp_io.c @@ -151,6 +151,9 @@ static void close_file P((SOCKET)); #endif #ifdef F_DUPFD static int dup_fd P((int)); +#ifndef FOPEN_MAX +#define FOPEN_MAX 20 +#endif #endif static char * fdbits P((int, fd_set *)); @@ -252,8 +255,8 @@ static int dup_fd(int fd) /* * Leave a space for stdio to work in. */ - if (fd >= 0 && fd < 20) { - newfd = fcntl(fd, F_DUPFD, 20); + if (fd >= 0 && fd < FOPEN_MAX) { + newfd = fcntl(fd, F_DUPFD, FOPEN_MAX); tmp = errno; if (newfd == -1)