diff options
Diffstat (limited to 'sunrpc/svc.c')
-rw-r--r-- | sunrpc/svc.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/sunrpc/svc.c b/sunrpc/svc.c index 6caf841..1e358e2 100644 --- a/sunrpc/svc.c +++ b/sunrpc/svc.c @@ -372,7 +372,7 @@ svc_getreqset (fd_set *readfds) setsize = FD_SETSIZE; maskp = readfds->fds_bits; for (sock = 0; sock < setsize; sock += NFDBITS) - for (mask = *maskp++; (bit = ffs (mask)); mask ^= (1 << (bit - 1))) + for (mask = *maskp++; (bit = ffsl (mask)); mask ^= (1L << (bit - 1))) INTUSE(svc_getreq_common) (sock + bit - 1); } INTDEF (svc_getreqset) @@ -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; } } } |