Production sysctl_tuning hardening and upgrade-safe defaults

This commit is contained in:
2026-05-28 12:01:08 +05:00
parent 2c27bff800
commit 10b2d0aefb
5 changed files with 191 additions and 15 deletions
+6
View File
@@ -71,6 +71,7 @@ impl Drop for FileLock {
}
}
#[cfg(unix)]
fn is_stale_lock(path: &Path) -> anyhow::Result<bool> {
let pid_raw = fs::read_to_string(path)?;
let pid = match pid_raw.trim().parse::<u32>() {
@@ -82,6 +83,11 @@ fn is_stale_lock(path: &Path) -> anyhow::Result<bool> {
Ok(!Path::new(&proc_path).exists())
}
#[cfg(not(unix))]
fn is_stale_lock(_path: &Path) -> anyhow::Result<bool> {
Ok(false)
}
#[cfg(test)]
mod tests {
use super::*;