Skip to content

Commit 05d675b

Browse files
committed
fix(android): handle symlink and directory checks with appropriate type for Android platform
1 parent c8cc10c commit 05d675b

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ fn prompt_file_with_stat(path: &Path, stat: &libc::stat, options: &Options) -> b
4242
return true;
4343
}
4444

45-
let is_symlink = (stat.st_mode & (libc::S_IFMT as _)) == (libc::S_IFLNK as _);
45+
#[cfg(target_os = "android")]
46+
let is_symlink = (stat.st_mode & (libc::S_IFMT as u16)) == (libc::S_IFLNK as u16);
47+
#[cfg(not(target_os = "android"))]
48+
let is_symlink = (stat.st_mode & (libc::S_IFMT as u32)) == (libc::S_IFLNK as u32);
4649
let writable = mode_writable(stat.st_mode as libc::mode_t);
4750
let len = stat.st_size as u64;
4851
let stdin_ok = options.__presume_input_tty.unwrap_or(false) || stdin().is_terminal();
@@ -376,8 +379,10 @@ pub fn safe_remove_dir_recursive_impl(path: &Path, dir_fd: &DirFd, options: &Opt
376379
};
377380

378381
// Check if it's a directory
379-
let is_dir =
380-
(entry_stat.st_mode & (libc::S_IFMT as _)) == (libc::S_IFDIR as _);
382+
#[cfg(target_os = "android")]
383+
let is_dir = (entry_stat.st_mode & (libc::S_IFMT as u16)) == (libc::S_IFDIR as u16);
384+
#[cfg(not(target_os = "android"))]
385+
let is_dir = (entry_stat.st_mode & (libc::S_IFMT as u32)) == (libc::S_IFDIR as u32);
381386

382387
if is_dir {
383388
// Ask user if they want to descend into this directory

0 commit comments

Comments
 (0)