Module Name: src
Committed By: christos
Date: Sat May 9 15:12:12 UTC 2015
Modified Files:
src/usr.bin/rpcgen: rpc_svcout.c
Log Message:
CID 1225082: Check getrlimit() return
To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.bin/rpcgen/rpc_svcout.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/rpcgen/rpc_svcout.c
diff -u src/usr.bin/rpcgen/rpc_svcout.c:1.26 src/usr.bin/rpcgen/rpc_svcout.c:1.27
--- src/usr.bin/rpcgen/rpc_svcout.c:1.26 Sun Dec 15 01:07:39 2013
+++ src/usr.bin/rpcgen/rpc_svcout.c Sat May 9 11:12:12 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: rpc_svcout.c,v 1.26 2013/12/15 06:07:39 christos Exp $ */
+/* $NetBSD: rpc_svcout.c,v 1.27 2015/05/09 15:12:12 christos Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)rpc_svcout.c 1.29 89/03/30 (C) 1987 SMI";
#else
-__RCSID("$NetBSD: rpc_svcout.c,v 1.26 2013/12/15 06:07:39 christos Exp $");
+__RCSID("$NetBSD: rpc_svcout.c,v 1.27 2015/05/09 15:12:12 christos Exp $");
#endif
#endif
@@ -646,7 +646,7 @@ write_timeout_func(void)
f_print(fout, "static void closedown(void);\n");
f_print(fout, "\n");
f_print(fout, "static void\n");
- f_print(fout, "closedown()\n");
+ f_print(fout, "closedown(void)\n");
f_print(fout, "{\n");
f_print(fout, "\tif (_rpcsvcdirty == 0) {\n");
f_print(fout, "\t\textern fd_set svc_fdset;\n");
@@ -663,7 +663,8 @@ write_timeout_func(void)
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 (getrlimit(RLIMIT_NOFILE, &rl) == -1)\n");
+ f_print(fout, "\t\t\t\treturn;\n");
f_print(fout, "\t\t\tif ((size = rl.rlim_max) == 0)\n");
f_print(fout, "\t\t\t\treturn;\n");
} else {