From 640d302345a4dfa196320432e1b674c0b7d946e0 Mon Sep 17 00:00:00 2001 From: cloudhead Date: Wed, 17 Jan 2024 17:38:52 +0100 Subject: [PATCH] Don't ever decrease rlimit In case the rlimit is already higher than the desired number, we leave it as-is. --- radicle/src/io.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/radicle/src/io.rs b/radicle/src/io.rs index f1d8aa17..86a6db7e 100644 --- a/radicle/src/io.rs +++ b/radicle/src/io.rs @@ -14,6 +14,9 @@ pub fn set_file_limit(n: u64) -> io::Result { 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 {