rpcgen(1): Check getrlimit() return for generated code.
Obtained from: NetBSD (CVS rev 1.27, 1.28) MFC after: 1 week
This commit is contained in:
parent
062a4b8c68
commit
f5ab496e62
@ -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, const char *sp)
|
||||
/* 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 {
|
||||
|
Loading…
Reference in New Issue
Block a user