summaryrefslogtreecommitdiffstats
path: root/utils/mountd
diff options
context:
space:
mode:
authorneilbrown <neilbrown>2003-09-12 06:37:16 +0000
committerneilbrown <neilbrown>2003-09-12 06:37:16 +0000
commit06c962bc87aba28a3169be6a18ce8d52060b661f (patch)
tree016e5753871fc1f14ef0161c71ff458edeb46f1c /utils/mountd
parent2ff7a4def6b60f2d1868d3da2a537b90ee058d30 (diff)
downloadnfs-utils-06c962bc87aba28a3169be6a18ce8d52060b661f.tar.gz
nfs-utils-06c962bc87aba28a3169be6a18ce8d52060b661f.tar.xz
nfs-utils-06c962bc87aba28a3169be6a18ce8d52060b661f.zip
Work around RLIMIT_NOFILE-to-big problem
Diffstat (limited to 'utils/mountd')
-rw-r--r--utils/mountd/mountd.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/utils/mountd/mountd.c b/utils/mountd/mountd.c
index 0b34617..0d4ddb4 100644
--- a/utils/mountd/mountd.c
+++ b/utils/mountd/mountd.c
@@ -504,18 +504,21 @@ main(int argc, char **argv)
exit(1);
}
- if (descriptors) {
- if (getrlimit (RLIMIT_NOFILE, &rlim) != 0) {
- fprintf(stderr, "%s: getrlimit (RLIMIT_NOFILE) failed: %s\n",
+ if (getrlimit (RLIMIT_NOFILE, &rlim) != 0)
+ fprintf(stderr, "%s: getrlimit (RLIMIT_NOFILE) failed: %s\n",
argv [0], strerror(errno));
- exit(1);
- }
-
- rlim.rlim_cur = descriptors;
- if (setrlimit (RLIMIT_NOFILE, &rlim) != 0) {
- fprintf(stderr, "%s: setrlimit (RLIMIT_NOFILE) failed: %s\n",
- argv [0], strerror(errno));
- exit(1);
+ else {
+ /* glibc sunrpc code dies if getdtablesize > FD_SETSIZE */
+ if (descriptors == 0 && rlim.rlim_cur > FD_SETSIZE)
+ descriptors = FD_SETSIZE;
+ if (descriptors) {
+
+ rlim.rlim_cur = descriptors;
+ if (setrlimit (RLIMIT_NOFILE, &rlim) != 0) {
+ fprintf(stderr, "%s: setrlimit (RLIMIT_NOFILE) failed: %s\n",
+ argv [0], strerror(errno));
+ exit(1);
+ }
}
}
/* Initialize logging. */