Skip to content

Commit

Permalink
Fix issue with using u16 mask on macOS.
Browse files Browse the repository at this point in the history
  • Loading branch information
hanbings committed Aug 11, 2024
1 parent a672f35 commit e3562de
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/find/matchers/ls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use super::{Matcher, MatcherIO};

#[cfg(unix)]
fn format_permissions(mode: u32) -> String {
let file_type = match mode & uucore::libc::S_IFMT {
let file_type = match mode & uucore::libc::S_IFMT as u32 {
uucore::libc::S_IFDIR => "d",
uucore::libc::S_IFREG => "-",
_ => "?",
Expand All @@ -23,17 +23,17 @@ fn format_permissions(mode: u32) -> String {
// S_$$USR means "user permissions"
let user_perms = format!(
"{}{}{}",
if mode & uucore::libc::S_IRUSR != 0 {
if mode & uucore::libc::S_IRUSR as u32 != 0 {
"r"
} else {
"-"
},
if mode & uucore::libc::S_IWUSR != 0 {
if mode & uucore::libc::S_IWUSR as u32 != 0 {
"w"
} else {
"-"
},
if mode & uucore::libc::S_IXUSR != 0 {
if mode & uucore::libc::S_IXUSR as u32 != 0 {
"x"
} else {
"-"
Expand All @@ -43,17 +43,17 @@ fn format_permissions(mode: u32) -> String {
// S_$$GRP means "group permissions"
let group_perms = format!(
"{}{}{}",
if mode & uucore::libc::S_IRGRP != 0 {
if mode & uucore::libc::S_IRGRP as u32 != 0 {
"r"
} else {
"-"
},
if mode & uucore::libc::S_IWGRP != 0 {
if mode & uucore::libc::S_IWGRP as u32 != 0 {
"w"
} else {
"-"
},
if mode & uucore::libc::S_IXGRP != 0 {
if mode & uucore::libc::S_IXGRP as u32 != 0 {
"x"
} else {
"-"
Expand All @@ -63,17 +63,17 @@ fn format_permissions(mode: u32) -> String {
// S_$$OTH means "other permissions"
let other_perms = format!(
"{}{}{}",
if mode & uucore::libc::S_IROTH != 0 {
if mode & uucore::libc::S_IROTH as u32 != 0 {
"r"
} else {
"-"
},
if mode & uucore::libc::S_IWOTH != 0 {
if mode & uucore::libc::S_IWOTH as u32 != 0 {
"w"
} else {
"-"
},
if mode & uucore::libc::S_IXOTH != 0 {
if mode & uucore::libc::S_IXOTH as u32 != 0 {
"x"
} else {
"-"
Expand Down

0 comments on commit e3562de

Please sign in to comment.