diff mbox series

[v1,1/2] _rpc_dtablesize: Decrease the value of size.

Message ID 724549cc2342aaa4b3832967e086252134528d3f.1698751763.git.zhuohao_bai@foxmail.com (mailing list archive)
State New
Headers show
Series _rpc_dtablesize: decrease to fix excessive memory usage | expand

Commit Message

Zhuohao Bai Oct. 31, 2023, 1:13 p.m. UTC
To fix the bug caused by a Size value that is too large and leads to an array
that requires excessive memory, which subsequently results in the failure of
rpcbind to start properly.

Signed-off-by: Zhuohao Bai <zhuohao_bai@foxmail.com>
---
 src/rpc_dtablesize.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/src/rpc_dtablesize.c b/src/rpc_dtablesize.c
index bce97e8..12f80c1 100644
--- a/src/rpc_dtablesize.c
+++ b/src/rpc_dtablesize.c
@@ -41,7 +41,7 @@  _rpc_dtablesize(void)
 	static int size;
 
 	if (size == 0) {
-		size = sysconf(_SC_OPEN_MAX);
+		size = min(1024, sysconf(_SC_OPEN_MAX));
 	}
 	return (size);
 }