From 9f0fbc30151f964bc92a3ba5772038eaf2492bf7 Mon Sep 17 00:00:00 2001 From: Jon Trulson Date: Mon, 10 Mar 2014 14:49:37 -0600 Subject: [PATCH] mp_rpc_server.C: limit iteration of svc_fdset to FD_SETSIZE, as per spec. In init() there was code iterating over all of the possible file descriptors in a svc_fdset. fdsets are limited to FD_SETSIZE. This caused coredumps on FreeBSD 10, and possibly other hidden issues. Moving to poll(), rather than select() would be better, but is a bigger job. For now, just limit to the FD_SETSIZE that select() requires. --- cde/lib/tt/slib/mp_rpc_server.C | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cde/lib/tt/slib/mp_rpc_server.C b/cde/lib/tt/slib/mp_rpc_server.C index 8292c86f..0bd690f1 100644 --- a/cde/lib/tt/slib/mp_rpc_server.C +++ b/cde/lib/tt/slib/mp_rpc_server.C @@ -244,8 +244,7 @@ init(void (*service_fn)(struct svc_req *, SVCXPRT *)) (void)endnetconfig(handlep); #endif /* OPT_TLI */ // now figure out what fd the rpc package is using - int maxfds = _tt_global->maxfds(); - for (int i=0; i < maxfds; i++) { + for (int i=0; i < FD_SETSIZE; i++) { if (FD_ISSET(i, &svc_fdset)) { _rpc_fd = i; } -- 2.25.1