Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/rpcgen Also check the other emitted getrlimit call f...



details:   https://anonhg.NetBSD.org/src/rev/9b22d3fdb924
branches:  trunk
changeset: 338071:9b22d3fdb924
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sat May 09 18:48:14 2015 +0000

description:
Also check the other emitted getrlimit call for failure.

diffstat:

 usr.bin/rpcgen/rpc_svcout.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (31 lines):

diff -r 3e656e2eb955 -r 9b22d3fdb924 usr.bin/rpcgen/rpc_svcout.c
--- a/usr.bin/rpcgen/rpc_svcout.c       Sat May 09 18:47:26 2015 +0000
+++ b/usr.bin/rpcgen/rpc_svcout.c       Sat May 09 18:48:14 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rpc_svcout.c,v 1.27 2015/05/09 15:12:12 christos Exp $ */
+/*     $NetBSD: rpc_svcout.c,v 1.28 2015/05/09 18:48:14 dholland 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.27 2015/05/09 15:12:12 christos Exp $");
+__RCSID("$NetBSD: rpc_svcout.c,v 1.28 2015/05/09 18:48:14 dholland Exp $");
 #endif
 #endif
 
@@ -820,7 +820,11 @@
        /* get number of file descriptors */
        if (tirpcflag) {
                f_print(fout, "%srl.rlim_max = 0;\n", sp);
-               f_print(fout, "%sgetrlimit(RLIMIT_NOFILE, &rl);\n", sp);
+               f_print(fout, "%sif (getrlimit(RLIMIT_NOFILE, &rl) == -1) {\n",
+                       sp);
+               f_print(fout, "%s\tperror(\"getrlimit\");\n", sp);
+               f_print(fout, "%s\texit(1);\n", sp);
+               f_print(fout, "%s}\n", sp);
                f_print(fout, "%sif ((size = rl.rlim_max) == 0)\n", sp);
                f_print(fout, "%s\texit(1);\n", sp);
        } else {



Home | Main Index | Thread Index | Old Index