mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-11 05:17:44 +03:00
tests: don't change hard limit in test-rlimit-util
Fixes: $ make valgrind-tests TESTS=test-rlimit-util ... Running test-rlimit-util Assertion 'setrlimit(RLIMIT_NOFILE, &new) >= 0' failed at src/test/test-rlimit-util.c:41, function main(). Aborting. See http://valgrind.org/docs/manual/dist.news.old.html The setrlimit system call now simply updates the emulated limits as best as possible - the hard limit is not allowed to move at all and just returns EPERM if you try and change it.
This commit is contained in:
parent
05442a9cdc
commit
d5bc32d103
@ -37,7 +37,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
assert_se(getrlimit(RLIMIT_NOFILE, &old) == 0);
|
||||
new.rlim_cur = MIN(5U, old.rlim_max);
|
||||
new.rlim_max = MIN(10U, old.rlim_max);
|
||||
new.rlim_max = old.rlim_max;
|
||||
assert_se(setrlimit(RLIMIT_NOFILE, &new) >= 0);
|
||||
|
||||
assert_se(rlimit_from_string("LimitNOFILE") == RLIMIT_NOFILE);
|
||||
@ -53,7 +53,7 @@ int main(int argc, char *argv[]) {
|
||||
assert_se(old.rlim_max == new.rlim_max);
|
||||
|
||||
assert_se(getrlimit(RLIMIT_NOFILE, &old) == 0);
|
||||
high = RLIMIT_MAKE_CONST(old.rlim_max + 1);
|
||||
high = RLIMIT_MAKE_CONST(old.rlim_max == RLIM_INFINITY ? old.rlim_max : old.rlim_max + 1);
|
||||
assert_se(setrlimit_closest(RLIMIT_NOFILE, &high) == 0);
|
||||
assert_se(getrlimit(RLIMIT_NOFILE, &new) == 0);
|
||||
assert_se(new.rlim_max == old.rlim_max);
|
||||
|
Loading…
Reference in New Issue
Block a user