]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - utils/mountd/mountd.c
Release 1.0.5
[nfs-utils.git] / utils / mountd / mountd.c
index ae5daa12fff4fc491c6707f74f6ed402f14fc595..d0d8103583818fe50cd38653655f281449be50ef 100644 (file)
@@ -431,7 +431,7 @@ main(int argc, char **argv)
        char    *export_file = _PATH_EXPORTS;
        int     foreground = 0;
        int     port = 0;
-       int     descriptors = 256;
+       int     descriptors = 0;
        int     c;
        struct sigaction sa;
        struct rlimit rlim;
@@ -498,19 +498,20 @@ main(int argc, char **argv)
                exit(1);
        }
 
-       if (getrlimit (RLIMIT_NOFILE, &rlim) != 0) {
-               fprintf(stderr, "%s: getrlimit (RLIMIT_NOFILE) failed: %s\n",
-                       argv [0], strerror(errno));
-               exit(1);
-       }
+       if (descriptors) {
+               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);
+               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. */
 /*     xlog_open("mountd"); */