Skip to content

Use libc::__error() rather than libc::__errno_location() on macOS

Michael Aaron Murphy requested to merge gibfahn:macos-fix into master

Created by: gibfahn

Use libc::__error() rather than libc::__errno_location().

Error:

error[E0425]: cannot find function `__errno_location` in module `libc`
  --> src/lib/sys/unix/mod.rs:28:37
   |
28 | fn errno() -> i32 { unsafe { *libc::__errno_location() } }
   |                                     ^^^^^^^^^^^^^^^^ not found in `libc`

Fixed by copying what nix does:

https://github.com/nix-rust/nix/blob/2f09d4c1dac302f4602740da4020d80033b57fcc/src/errno.rs#L9-L46

Merge request reports