diff -urN 2.4.9/fs/select.c poll/fs/select.c
--- 2.4.9/fs/select.c	Thu Aug 16 22:03:38 2001
+++ poll/fs/select.c	Sat Aug 18 03:09:11 2001
@@ -416,7 +416,7 @@
 	int nchunks, nleft;
 
 	/* Do a sanity check on nfds ... */
-	if (nfds > NR_OPEN)
+	if (nfds > current->rlim[RLIMIT_NOFILE].rlim_cur)
 		return -EINVAL;
 
 	if (timeout) {