diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2001-01-11 19:24:25 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2001-01-11 19:24:25 +0000 |
commit | c767e4795eb92f93d635e7bc14faa9846435c642 (patch) | |
tree | 60310719ca9b5c14e527dbe7ecfaf0daf2449e7b | |
parent | b7d8fea095d95a3f7e5e18e07f7a27fb7346be99 (diff) |
make closedown() use __svc_fdset, so that large fd_set sizes close down nice
-rw-r--r-- | usr.bin/rpcgen/rpc_svcout.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/usr.bin/rpcgen/rpc_svcout.c b/usr.bin/rpcgen/rpc_svcout.c index 334135eb56c..e127e2d5cf7 100644 --- a/usr.bin/rpcgen/rpc_svcout.c +++ b/usr.bin/rpcgen/rpc_svcout.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rpc_svcout.c,v 1.2 1996/06/26 05:38:40 deraadt Exp $ */ +/* $OpenBSD: rpc_svcout.c,v 1.3 2001/01/11 19:24:24 deraadt Exp $ */ /* $NetBSD: rpc_svcout.c,v 1.7 1995/06/24 14:59:59 pk Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for @@ -647,8 +647,8 @@ write_timeout_func() f_print(fout, "closedown()\n"); f_print(fout, "{\n"); f_print(fout, "\tif (_rpcsvcdirty == 0) {\n"); - f_print(fout, "\t\textern fd_set svc_fdset;\n"); - f_print(fout, "\t\tstatic int size;\n"); + f_print(fout, "\t\textern fd_set *__svc_fdset;\n"); + f_print(fout, "\t\textern int __svc_fdsetsize;\n"); f_print(fout, "\t\tint i, openfd;\n"); if (tirpcflag && pmflag) { f_print(fout, "\t\tstruct t_info tinfo;\n\n"); @@ -657,19 +657,8 @@ write_timeout_func() f_print(fout, "\n\t\tif (_rpcfdtype == SOCK_DGRAM)\n"); } f_print(fout, "\t\t\texit(0);\n"); - f_print(fout, "\t\tif (size == 0) {\n"); - if( tirpcflag ) { - f_print(fout, "\t\t\tstruct rlimit rl;\n\n"); - f_print(fout, "\t\t\trl.rlim_max = 0;\n"); - f_print(fout, "\t\t\tgetrlimit(RLIMIT_NOFILE, &rl);\n"); - f_print(fout, "\t\t\tif ((size = rl.rlim_max) == 0)\n"); - f_print(fout, "\t\t\t\treturn;\n"); - } else { - f_print(fout, "\t\t\tsize = getdtablesize();\n"); - } - f_print(fout, "\t\t}\n"); - f_print(fout, "\t\tfor (i = 0, openfd = 0; i < size && openfd < 2; i++)\n"); - f_print(fout, "\t\t\tif (FD_ISSET(i, &svc_fdset))\n"); + f_print(fout, "\t\tfor (i = 0, openfd = 0; i < __svc_fdsetsize && openfd < 2; i++)\n"); + f_print(fout, "\t\t\tif (FD_ISSET(i, __svc_fdset))\n"); f_print(fout, "\t\t\t\topenfd++;\n"); f_print(fout, "\t\tif (openfd <= (_rpcpmstart?0:1))\n"); f_print(fout, "\t\t\texit(0);\n"); |