diff --git a/src/uucore/src/lib/features/fs.rs b/src/uucore/src/lib/features/fs.rs index bc7f92dd7..ede2d07ee 100644 --- a/src/uucore/src/lib/features/fs.rs +++ b/src/uucore/src/lib/features/fs.rs @@ -763,9 +763,12 @@ pub fn are_hardlinks_or_one_way_symlink_to_same_file(source: &Path, target: &Pat /// # Arguments /// /// * `path` - A reference to the path to be checked. -#[cfg(unix)] +#[cfg(any(unix, target_os = "wasi"))] pub fn path_ends_with_terminator(path: &Path) -> bool { + #[cfg(unix)] use std::os::unix::prelude::OsStrExt; + #[cfg(target_os = "wasi")] + use std::os::wasi::ffi::OsStrExt; path.as_os_str() .as_bytes() .last() diff --git a/src/uucore/src/lib/features/mode.rs b/src/uucore/src/lib/features/mode.rs index 4e737595e..6a96307b2 100644 --- a/src/uucore/src/lib/features/mode.rs +++ b/src/uucore/src/lib/features/mode.rs @@ -7,7 +7,7 @@ // spell-checker:ignore (vars) fperm srwx -#[cfg(not(unix))] +#[cfg(windows)] use libc::umask; pub fn parse_numeric(fperm: u32, mut mode: &str, considering_dir: bool) -> Result { @@ -185,7 +185,7 @@ pub fn get_umask() -> u32 { mask.bits() as u32 } - #[cfg(not(unix))] + #[cfg(windows)] { // SAFETY: umask always succeeds and doesn't operate on memory. Races are // possible but it can't violate Rust's guarantees. @@ -193,6 +193,12 @@ pub fn get_umask() -> u32 { unsafe { umask(mask) }; mask as u32 } + + // WASI has no umask; return a typical default (022). + #[cfg(not(any(unix, windows)))] + { + 0o022 + } } #[cfg(test)]