From: David Mosberger <davidm@napali.hpl.hp.com>

I stared at it for a while and found a stupid error.  The first hunk
in the patch below should fix this error.  The second hunk should be a
no-op, but I think the resulting code is a bit cleaner.



 fs/select.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff -puN fs/select.c~select-speedup-fix fs/select.c
--- 25/fs/select.c~select-speedup-fix	2003-04-18 18:54:58.000000000 -0700
+++ 25-akpm/fs/select.c	2003-04-18 18:54:58.000000000 -0700
@@ -208,8 +208,10 @@ int do_select(int n, fd_set_bits *fds, l
 
 			in = *inp++; out = *outp++; ex = *exp++;
 			all_bits = in | out | ex;
-			if (all_bits == 0)
+			if (all_bits == 0) {
+				i += __NFDBITS;
 				continue;
+			}
 
 			for (j = 0; j < __NFDBITS; ++j, ++i, bit <<= 1) {
 				if (i >= n)
@@ -217,10 +219,9 @@ int do_select(int n, fd_set_bits *fds, l
 				if (!(bit & all_bits))
 					continue;
 				file = fget(i);
-				if (file)
-					f_op = file->f_op;
-				mask = DEFAULT_POLLMASK;
 				if (file) {
+					f_op = file->f_op;
+					mask = DEFAULT_POLLMASK;
 					if (f_op && f_op->poll)
 						mask = (*f_op->poll)(file, retval ? NULL : wait);
 					fput(file);

_