Don't ever decrease rlimit

In case the rlimit is already higher than the desired number, we leave
it as-is.
This commit is contained in:
cloudhead 2024-01-17 17:38:52 +01:00
parent f4f479d68f
commit 640d302345
No known key found for this signature in database
1 changed files with 3 additions and 0 deletions

View File

@ -14,6 +14,9 @@ pub fn set_file_limit(n: u64) -> io::Result<u64> {
return Err(io::Error::last_os_error());
}
}
if rlim.rlim_cur >= n {
return Ok(rlim.rlim_cur);
}
// Set the soft limit to the given value, up to the hard limit.
rlim.rlim_cur = n.min(rlim.rlim_max);
unsafe {