blob: e853b28c407fb4b3bf97326b8ce0f986ec7b8687 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
--- 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,
|