diff options
author | Ulrich Drepper <drepper@redhat.com> | 2005-11-04 00:55:03 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2005-11-04 00:55:03 +0000 |
commit | 30199a662344bb86f17f1d42905fedf452fa3e73 (patch) | |
tree | 8413156ed4b635f8eb00ed476631ba5336a41b77 /sunrpc/svc.c | |
parent | 77c4d1156f73444f4b1d897f423544869c880eae (diff) | |
download | glibc-30199a662344bb86f17f1d42905fedf452fa3e73.tar glibc-30199a662344bb86f17f1d42905fedf452fa3e73.tar.gz glibc-30199a662344bb86f17f1d42905fedf452fa3e73.tar.bz2 glibc-30199a662344bb86f17f1d42905fedf452fa3e73.zip |
(svc_getreq_poll): Fix inefficient loop test.
Diffstat (limited to 'sunrpc/svc.c')
-rw-r--r-- | sunrpc/svc.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sunrpc/svc.c b/sunrpc/svc.c index 53f628e699..1e358e247c 100644 --- a/sunrpc/svc.c +++ b/sunrpc/svc.c @@ -380,22 +380,24 @@ INTDEF (svc_getreqset) void svc_getreq_poll (struct pollfd *pfdp, int pollretval) { - register int i; - register int fds_found; + if (pollretval == 0) + return; - for (i = fds_found = 0; i < svc_max_pollfd && fds_found < pollretval; ++i) + register int fds_found; + for (int i = fds_found = 0; i < svc_max_pollfd; ++i) { register struct pollfd *p = &pfdp[i]; if (p->fd != -1 && p->revents) { /* fd has input waiting */ - ++fds_found; - if (p->revents & POLLNVAL) xprt_unregister (xports[p->fd]); else INTUSE(svc_getreq_common) (p->fd); + + if (++fds_found >= pollretval) + break; } } } |