Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/rpcgen CID 1225082: Check getrlimit() return



details:   https://anonhg.NetBSD.org/src/rev/980243a3c6a4
branches:  trunk
changeset: 338052:980243a3c6a4
user:      christos <christos%NetBSD.org@localhost>
date:      Sat May 09 15:12:12 2015 +0000

description:
CID 1225082: Check getrlimit() return

diffstat:

 usr.bin/rpcgen/rpc_svcout.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (37 lines):

diff -r c7ea8dd17447 -r 980243a3c6a4 usr.bin/rpcgen/rpc_svcout.c
--- a/usr.bin/rpcgen/rpc_svcout.c       Sat May 09 14:22:34 2015 +0000
+++ b/usr.bin/rpcgen/rpc_svcout.c       Sat May 09 15:12:12 2015 +0000
@@ -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 @@
        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 @@
        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 {



Home | Main Index | Thread Index | Old Index