svn commit: r312385 - stable/11/usr.bin/rpcgen
Pedro F. Giffuni
pfg at FreeBSD.org
Wed Jan 18 15:22:55 UTC 2017
Author: pfg
Date: Wed Jan 18 15:22:54 2017
New Revision: 312385
URL: https://svnweb.freebsd.org/changeset/base/312385
Log:
MFC r311947, r311981:
rpcgen(1): Avoid unused variable warning on generated code.
Avoid "unused variable 'i'" warnings in generated .c files by only
emitting the "int i;" for non-opaque arrays. Opaque arrays use
xdr_opaque() rather than iterating over the array.
Obtained from: OpenBSD (CVS rev 1.28)
rpcgen(1): Check getrlimit() return for generated code.
Obtained from: NetBSD (CVS rev 1.27, 1.28)
Modified:
stable/11/usr.bin/rpcgen/rpc_cout.c
stable/11/usr.bin/rpcgen/rpc_svcout.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/usr.bin/rpcgen/rpc_cout.c
==============================================================================
--- stable/11/usr.bin/rpcgen/rpc_cout.c Wed Jan 18 14:41:59 2017 (r312384)
+++ stable/11/usr.bin/rpcgen/rpc_cout.c Wed Jan 18 15:22:54 2017 (r312385)
@@ -551,7 +551,8 @@ emit_struct(definition *def)
}
for (dl = def->def.st.decls; dl != NULL; dl = dl->next)
- if (dl->decl.rel == REL_VECTOR){
+ if (dl->decl.rel == REL_VECTOR &&
+ strcmp(dl->decl.type, "opaque") != 0){
f_print(fout, "\tint i;\n");
break;
}
Modified: stable/11/usr.bin/rpcgen/rpc_svcout.c
==============================================================================
--- stable/11/usr.bin/rpcgen/rpc_svcout.c Wed Jan 18 14:41:59 2017 (r312384)
+++ stable/11/usr.bin/rpcgen/rpc_svcout.c Wed Jan 18 15:22:54 2017 (r312385)
@@ -728,7 +728,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");
if (mtflag)
@@ -902,7 +903,11 @@ write_rpc_svc_fg(const char *infile, con
/* 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 {
More information about the svn-src-stable
mailing list