diff options
author | dormando <dormando@rydia.net> | 2021-11-22 17:36:16 -0800 |
---|---|---|
committer | dormando <dormando@rydia.net> | 2021-11-22 17:36:16 -0800 |
commit | b95ca35702a9ba3cdd8e0ad66137f95dea71cbe7 (patch) | |
tree | ef4b97e181763eda54077ff47f4b2079dabd42a1 /memcached.c | |
parent | 9917c798503e14b026c67068f1406bfc23c5a5b9 (diff) | |
download | memcached-b95ca35702a9ba3cdd8e0ad66137f95dea71cbe7.tar.gz |
Fix for #837 - tests fail on OS X
Always at least try to setrlimit to what we want it to be, but in debug
mode ignore if it fails. This isn't the greatest workaround but will
ensure the next release works under both valgrind and OS X. A better way
to detect valgrind (importing their huge .h file I guess?) would mean we
can skip setrlimit in that specific case only.
Diffstat (limited to 'memcached.c')
-rw-r--r-- | memcached.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/memcached.c b/memcached.c index bf6617d..34d972d 100644 --- a/memcached.c +++ b/memcached.c @@ -5730,18 +5730,14 @@ int main (int argc, char **argv) { fprintf(stderr, "failed to getrlimit number of files\n"); exit(EX_OSERR); } else { -#ifdef MEMCACHED_DEBUG - if (rlim.rlim_cur < settings.maxconns || rlim.rlim_max < settings.maxconns) { -#endif rlim.rlim_cur = settings.maxconns; rlim.rlim_max = settings.maxconns; if (setrlimit(RLIMIT_NOFILE, &rlim) != 0) { +#ifndef MEMCACHED_DEBUG fprintf(stderr, "failed to set rlimit for open files. Try starting as root or requesting smaller maxconns value.\n"); exit(EX_OSERR); - } -#ifdef MEMCACHED_DEBUG - } #endif + } } /* lose root privileges if we have them */ |