glibc doesn't guarantee anything about setrlimit with a NULL limit argument.
It could just crash (if it needs to adjust the limit) or might silently
succeed (as newer glibc do). Just remove the extra check.
See also the "setrlimit change to prlimit change in behavior" thread:
https://sourceware.org/ml/libc-alpha/2017-10/threads.html#00830
385183 PPC64, Add support for xscmpeqdp, xscmpgtdp, xscmpgedp, xsmincdp instructions
385334 PPC64, fix vpermr, xxperm, xxpermr mask value.
385868 glibc ld.so _dl_runtime_resolve_avx_slow conditional jump warning.
+385912 none/tests/rlimit_nofile fails on newer glibc/kernel.
Release 3.13.0 (15 June 2017)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
perror("open");
}
- if (setrlimit(RLIMIT_NOFILE, NULL) != -1 || errno != EFAULT)
- {
- fprintf(stderr, "setrlimit non addressable arg2 must set errno=EFAULT\n");
- exit(1);
- }
+ /* We used to test setrlimit(RLIMIT_NOFILE, NULL) -1 || errno != EFAULT,
+ but glibc doesn't give any guarantees that won't just crash, in
+ newer versions it just silently succeeds... See bug #385912. */
exit(0);
}