--- a/src/main.rs +++ b/src/main.rs @@ -34,7 +34,13 @@ fn main() { // Close all fds we inherited from our parent process, we only need stdio. + // musl's libc crate exposes SYS_close_range but not the safe + // wrapper (only defined for target_env = "gnu" upstream), so fall + // back to the raw syscall there. + #[cfg(target_env = "gnu")] let _ = unsafe { libc::close_range(3, libc::c_uint::MAX, 0) }; + #[cfg(not(target_env = "gnu"))] + let _ = unsafe { libc::syscall(libc::SYS_close_range, 3u32, libc::c_uint::MAX, 0u32) }; let formatter = Formatter3164 { facility: Facility::LOG_USER,