You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
990 B

autofs-5.0.7 - use ulimit max open files if greater than internal maximum
From: Ian Kent <raven@themaw.net>
When setting the maximum number of allowed file handles the current setting
should be checked before setting it. If the ulimit command has been used to
increase the maximum to larger than what automount would ask for then honour
it.
---
daemon/automount.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/daemon/automount.c b/daemon/automount.c
index 019637f..1d0b64e 100644
--- a/daemon/automount.c
+++ b/daemon/automount.c
@@ -2106,8 +2106,11 @@ int main(int argc, char *argv[])
exit(1);
}
- rlim.rlim_cur = MAX_OPEN_FILES;
- rlim.rlim_max = MAX_OPEN_FILES;
+ res = getrlimit(RLIMIT_NOFILE, &rlim);
+ if (res == -1 || rlim.rlim_max <= MAX_OPEN_FILES) {
+ rlim.rlim_cur = MAX_OPEN_FILES;
+ rlim.rlim_max = MAX_OPEN_FILES;
+ }
res = setrlimit(RLIMIT_NOFILE, &rlim);
if (res)
printf("%s: can't increase open file limit - continuing",