Skip to content

Commit 9f41965

Browse files
committed
fix(redox): move libc import under the correct conditional compilation
1 parent d946a9d commit 9f41965

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/uu/rm/src/platform/unix.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@ pub fn safe_remove_dir_recursive(
345345
}
346346
}
347347

348+
#[cfg(not(target_os = "redox"))]
348349
pub fn safe_remove_dir_recursive_impl(path: &Path, dir_fd: &DirFd, options: &Options) -> bool {
349350
// Read directory entries using safe traversal
350351
let entries = match dir_fd.read_dir() {
@@ -432,3 +433,10 @@ pub fn safe_remove_dir_recursive_impl(path: &Path, dir_fd: &DirFd, options: &Opt
432433

433434
error
434435
}
436+
437+
#[cfg(target_os = "redox")]
438+
pub fn safe_remove_dir_recursive_impl(_path: &Path, _dir_fd: &DirFd, _options: &Options) -> bool {
439+
// safe_traversal stat_at is not supported on Redox
440+
// This shouldn't be called on Redox, but provide a stub for compilation
441+
true // Return error
442+
}

src/uucore/src/lib/features/safe_traversal.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ use std::os::unix::ffi::OsStrExt;
2020
use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, OwnedFd, RawFd};
2121
use std::path::{Path, PathBuf};
2222

23+
#[cfg(target_os = "redox")]
24+
use libc;
2325
#[cfg(not(target_os = "redox"))]
2426
use nix::dir::Dir;
2527
#[cfg(not(target_os = "redox"))]
@@ -30,8 +32,6 @@ use nix::libc;
3032
use nix::sys::stat::{FchmodatFlags, FileStat, Mode, fchmodat, fstatat};
3133
#[cfg(not(target_os = "redox"))]
3234
use nix::unistd::{Gid, Uid, UnlinkatFlags, fchown, fchownat, unlinkat};
33-
#[cfg(target_os = "redox")]
34-
use libc;
3535
use os_display::Quotable;
3636

3737
use crate::translate;

0 commit comments

Comments
 (0)