Skip to content

Commit e4f13ef

Browse files
committed
fix(uucore): gate unix-specific safe_traversal methods for redox
1 parent 5704355 commit e4f13ef

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ impl DirFd {
276276
}
277277

278278
/// Read directory entries
279+
#[cfg(not(target_os = "redox"))]
279280
pub fn read_dir(&self) -> io::Result<Vec<OsString>> {
280281
read_dir_entries(&self.fd).map_err(|e| {
281282
SafeTraversalError::ReadDirFailed {
@@ -287,6 +288,7 @@ impl DirFd {
287288
}
288289

289290
/// Remove a file or empty directory relative to this directory
291+
#[cfg(not(target_os = "redox"))]
290292
pub fn unlink_at(&self, name: &OsStr, is_dir: bool) -> io::Result<()> {
291293
let name_cstr =
292294
CString::new(name.as_bytes()).map_err(|_| SafeTraversalError::PathContainsNull)?;
@@ -308,6 +310,7 @@ impl DirFd {
308310

309311
/// Change ownership of a file relative to this directory
310312
/// Use uid/gid of None to keep the current value
313+
#[cfg(not(target_os = "redox"))]
311314
pub fn chown_at(
312315
&self,
313316
name: &OsStr,
@@ -334,6 +337,7 @@ impl DirFd {
334337
}
335338

336339
/// Change ownership of this directory
340+
#[cfg(not(target_os = "redox"))]
337341
pub fn fchown(&self, uid: Option<u32>, gid: Option<u32>) -> io::Result<()> {
338342
let uid = uid.map(Uid::from_raw);
339343
let gid = gid.map(Gid::from_raw);
@@ -344,6 +348,7 @@ impl DirFd {
344348
}
345349

346350
/// Change mode of a file relative to this directory
351+
#[cfg(not(target_os = "redox"))]
347352
pub fn chmod_at(&self, name: &OsStr, mode: u32, follow_symlinks: bool) -> io::Result<()> {
348353
let flags = if follow_symlinks {
349354
FchmodatFlags::FollowSymlink
@@ -363,6 +368,7 @@ impl DirFd {
363368
}
364369

365370
/// Change mode of this directory
371+
#[cfg(not(target_os = "redox"))]
366372
pub fn fchmod(&self, mode: u32) -> io::Result<()> {
367373
let mode = Mode::from_bits_truncate(mode as libc::mode_t);
368374

0 commit comments

Comments
 (0)