Skip to content

Commit

Permalink
Do not use open64 on linux with musl
Browse files Browse the repository at this point in the history
glibc is providing open64 and other lfs64 functions but musl aliases
them to normal equivalents since off_t is always 64-bit on musl,
therefore check for target env along when target OS is linux before
using open64, this is more available. Latest Musl has made these
namespace changes [1]

[1] https://git.musl-libc.org/cgit/musl/commit/?id=246f1c811448f37a44b41cd8df8d0ef9736d95f4

Signed-off-by: Khem Raj <raj.khem@gmail.com>
  • Loading branch information
kraj committed Dec 29, 2022
1 parent beb65e2 commit ad9a971
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/util_libc.rs
Expand Up @@ -139,7 +139,7 @@ impl Weak {
}

cfg_if! {
if #[cfg(any(target_os = "linux", target_os = "emscripten"))] {
if #[cfg(any(all(target_os = "linux", not(target_env = "musl")), target_os = "emscripten"))] {
use libc::open64 as open;
} else {
use libc::open;
Expand Down

0 comments on commit ad9a971

Please sign in to comment.