diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index 905b1a16f..09c111162 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -36,14 +36,14 @@ jobs: os: ubuntu-latest features: "" target: "x86_64-unknown-linux-gnu" - # - rust: "stable" - # os: macos-latest - # features: "" - # target: "x86_64-apple-darwin" - # - rust: "stable" - # os: macos-14 - # features: "" - # target: "aarch64-apple-darwin" + - rust: "stable" + os: macos-latest + features: "" + target: "x86_64-apple-darwin" + - rust: "stable" + os: macos-14 + features: "" + target: "aarch64-apple-darwin" # - rust: stable-x86_64-gnu # os: windows-2022 # features: "" diff --git a/bzip2.rs b/bzip2.rs index 23ecc1e7c..58e8b3310 100644 --- a/bzip2.rs +++ b/bzip2.rs @@ -18,10 +18,22 @@ use libc::{ perror, remove, rewind, signal, stat, strcat, strcmp, strlen, strncpy, ungetc, utimbuf, write, FILE, }; + +// FIXME remove this extern "C" { + #[cfg(all(target_os = "linux", target_env = "gnu"))] static mut stdin: *mut FILE; + #[cfg(all(target_os = "linux", target_env = "gnu"))] + static mut stdout: *mut FILE; + + #[cfg(target_os = "macos")] + #[link_name = "__stdinp"] + static mut stdin: *mut FILE; + #[cfg(target_os = "macos")] + #[link_name = "__stdoutp"] static mut stdout: *mut FILE; } + type Bool = libc::c_uchar; type IntNative = libc::c_int; @@ -971,13 +983,13 @@ unsafe fn countHardLinks(name: *mut c_char) -> i32 { #[cfg(unix)] fn count_hardlinks(path: &Path) -> u64 { - use std::os::linux::fs::MetadataExt; + use std::os::unix::fs::MetadataExt; let Ok(metadata) = path.metadata() else { return 0; }; - metadata.st_nlink().saturating_sub(1) + metadata.nlink().saturating_sub(1) } #[cfg(not(unix))] diff --git a/bzip2recover.rs b/bzip2recover.rs index 36b6a8e50..528ab8e96 100644 --- a/bzip2recover.rs +++ b/bzip2recover.rs @@ -343,7 +343,8 @@ fn main_help(program_name: &Path, in_filename: &Path) -> Result<(), Error> { options.write(true).create(true); #[cfg(unix)] - options.mode(libc::S_IWUSR | libc::S_IRUSR); + #[allow(clippy::unnecessary_cast)] + options.mode(libc::S_IWUSR as u32 | libc::S_IRUSR as u32); #[cfg(unix)] options.custom_flags(libc::O_EXCL); diff --git a/bzlib.rs b/bzlib.rs index 1b0887415..7c71945c0 100644 --- a/bzlib.rs +++ b/bzlib.rs @@ -10,9 +10,19 @@ use crate::decompress::{self, decompress}; use crate::libbzip2_rs_sys_version; use crate::BZ_MAX_UNUSED; +// FIXME remove this extern "C" { - static stdin: *mut FILE; - static stdout: *mut FILE; + #[cfg(all(target_os = "linux", target_env = "gnu"))] + static mut stdin: *mut FILE; + #[cfg(all(target_os = "linux", target_env = "gnu"))] + static mut stdout: *mut FILE; + + #[cfg(target_os = "macos")] + #[link_name = "__stdinp"] + static mut stdin: *mut FILE; + #[cfg(target_os = "macos")] + #[link_name = "__stdoutp"] + static mut stdout: *mut FILE; } pub(crate) const BZ_MAX_ALPHA_SIZE: usize = 258;