Limit the upper bound of the value returned by _rpc_dtablesize() to not

break select(2) calls.
This commit is contained in:
andrew 1994-08-15 07:56:50 +00:00
parent 8f2482ff3d
commit 8eabc08051
1 changed files with 8 additions and 1 deletions

View File

@ -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 <sys/types.h>
/*
* 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);
}