From 8eabc0805107b5c8da58baaf8bae00b45171b144 Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 15 Aug 1994 07:56:50 +0000 Subject: [PATCH] Limit the upper bound of the value returned by _rpc_dtablesize() to not break select(2) calls. --- lib/libc/rpc/rpc_dtablesize.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/libc/rpc/rpc_dtablesize.c b/lib/libc/rpc/rpc_dtablesize.c index 31e804135f19..b7620b9c5a72 100644 --- a/lib/libc/rpc/rpc_dtablesize.c +++ b/lib/libc/rpc/rpc_dtablesize.c @@ -30,9 +30,11 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)rpc_dtablesize.c 1.2 87/08/11 Copyr 1987 Sun Micro";*/ /*static char *sccsid = "from: @(#)rpc_dtablesize.c 2.1 88/07/29 4.0 RPCSRC";*/ -static char *rcsid = "$Id: rpc_dtablesize.c,v 1.1 1993/10/07 07:30:12 cgd Exp $"; +static char *rcsid = "$Id: rpc_dtablesize.c,v 1.2 1994/08/15 07:56:50 andrew Exp $"; #endif +#include + /* * Cache the result of getdtablesize(), so we don't have to do an * expensive system call every time. @@ -43,6 +45,11 @@ _rpc_dtablesize() if (size == 0) { size = getdtablesize(); +#ifdef FD_SETSIZE + /* prevent select() from breaking */ + if (size > FD_SETSIZE) + size = FD_SETSIZE; +#endif } return (size); }