summaryrefslogtreecommitdiffstats
path: root/lib/libc/rpc/svc.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/rpc/svc.c')
-rw-r--r--lib/libc/rpc/svc.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/libc/rpc/svc.c b/lib/libc/rpc/svc.c
index 507d2e2..a002216 100644
--- a/lib/libc/rpc/svc.c
+++ b/lib/libc/rpc/svc.c
@@ -108,18 +108,19 @@ xprt_register(SVCXPRT *xprt)
rwlock_wrlock(&svc_fd_lock);
if (__svc_xports == NULL) {
__svc_xports = (SVCXPRT **)
- mem_alloc(FD_SETSIZE * sizeof(SVCXPRT *));
+ mem_alloc((FD_SETSIZE + 1) * sizeof(SVCXPRT *));
if (__svc_xports == NULL) {
rwlock_unlock(&svc_fd_lock);
return;
}
- memset(__svc_xports, '\0', FD_SETSIZE * sizeof(SVCXPRT *));
+ memset(__svc_xports, '\0', (FD_SETSIZE + 1) * sizeof(SVCXPRT *));
}
if (sock < FD_SETSIZE) {
__svc_xports[sock] = xprt;
FD_SET(sock, &svc_fdset);
svc_maxfd = max(svc_maxfd, sock);
- }
+ } else if (sock == FD_SETSIZE)
+ __svc_xports[sock] = xprt;
rwlock_unlock(&svc_fd_lock);
}
@@ -157,7 +158,8 @@ __xprt_do_unregister(SVCXPRT *xprt, bool_t dolock)
if (__svc_xports[svc_maxfd])
break;
}
- }
+ } else if ((sock == FD_SETSIZE) && (__svc_xports[sock] == xprt))
+ __svc_xports[sock] = NULL;
if (dolock)
rwlock_unlock(&svc_fd_lock);
}
OpenPOWER on IntegriCloud