--- 2.2.13-fdset/fs/open.c.~1~ Sat Oct 23 15:31:10 1999 +++ 2.2.13-fdset/fs/open.c Sat Oct 30 18:47:04 1999 @@ -712,7 +712,7 @@ /* Do we need to expand the fdset array? */ if (fd >= current->files->max_fdset) { - error = expand_fdset(files, 0); + error = expand_fdset(files, fd + 1); if (!error) goto repeat; goto out; @@ -722,7 +722,7 @@ * Check whether we need to expand the fd array. */ if (fd >= files->max_fds) { - error = expand_fd_array(files, 0); + error = expand_fd_array(files, fd + 1); if (!error) goto repeat; goto out; --- 2.2.13-fdset/include/linux/sched.h.~1~ Fri Oct 29 22:41:14 1999 +++ 2.2.13-fdset/include/linux/sched.h Sat Oct 30 18:46:32 1999 @@ -657,12 +657,12 @@ if (nr >= files->max_fdset) { expand = 1; - if ((err = expand_fdset(files, nr))) + if ((err = expand_fdset(files, nr + 1))) goto out; } if (nr >= files->max_fds) { expand = 1; - if ((err = expand_fd_array(files, nr))) + if ((err = expand_fd_array(files, nr + 1))) goto out; } err = expand;