diff options
author | Philip Hazel <ph10@hermes.cam.ac.uk> | 2004-10-18 09:26:02 +0000 |
---|---|---|
committer | Philip Hazel <ph10@hermes.cam.ac.uk> | 2004-10-18 09:26:02 +0000 |
commit | a494b1e1085547c1f1fb9429081bc2666b21fdc1 (patch) | |
tree | f07fa213213ec83d158accb93057f068f18708a2 /src | |
parent | 35edf2ff67ad9fa5fc0e83bde865d807c297864f (diff) |
If setrlimit() barfs at 1000 file descriptors, try for 256 to
accommodate those old OS for which this is the upper limit.
Diffstat (limited to 'src')
-rw-r--r-- | src/src/exim.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/src/exim.c b/src/src/exim.c index bfdcbc6e0..dcf261879 100644 --- a/src/src/exim.c +++ b/src/src/exim.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/exim.c,v 1.3 2004/10/18 09:16:57 ph10 Exp $ */ +/* $Cambridge: exim/src/src/exim.c,v 1.4 2004/10/18 09:26:02 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -2837,12 +2837,21 @@ else strerror(errno)); rlp.rlim_cur = rlp.rlim_max = 0; } + + /* I originally chose 1000 as a nice big number that was unlikely to + be exceeded. It turns out that some older OS have a fixed upper limit of + 256. */ + if (rlp.rlim_cur < 1000) { rlp.rlim_cur = rlp.rlim_max = 1000; if (setrlimit(RLIMIT_NOFILE, &rlp) < 0) - log_write(0, LOG_MAIN|LOG_PANIC, "setrlimit(RLIMIT_NOFILE) failed: %s", - strerror(errno)); + { + rlp.rlim_cur = rlp.rlim_max = 256; + if (setrlimit(RLIMIT_NOFILE, &rlp) < 0) + log_write(0, LOG_MAIN|LOG_PANIC, "setrlimit(RLIMIT_NOFILE) failed: %s", + strerror(errno)); + } } #endif |