diff -Nru linux-old/fs/fcntl.c linux-new/fs/fcntl.c
--- linux-old/fs/fcntl.c	2002-10-23 20:57:54.000000000 -0400
+++ linux-new/fs/fcntl.c	2002-10-23 21:03:20.000000000 -0400
@@ -257,7 +257,7 @@
 
 	switch (cmd) {
 		case F_DUPFD:
-			if (arg < NR_OPEN) {
+			if (arg < current->rlim[RLIMIT_NOFILE].rlim_cur) {
 				get_file(filp);
 				err = dupfd(filp, arg);
 			}
