Module Name:    src
Committed By:   dholland
Date:           Sat May  9 18:48:14 UTC 2015

Modified Files:
        src/usr.bin/rpcgen: rpc_svcout.c

Log Message:
Also check the other emitted getrlimit call for failure.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 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.27 src/usr.bin/rpcgen/rpc_svcout.c:1.28
--- src/usr.bin/rpcgen/rpc_svcout.c:1.27	Sat May  9 15:12:12 2015
+++ src/usr.bin/rpcgen/rpc_svcout.c	Sat May  9 18:48:14 2015
@@ -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 @@ write_rpc_svc_fg(char *infile, const cha
 	/* 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 {

Reply via email to