1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-31 13:07:46 +00:00

chmod: fix build on freebsd

This commit is contained in:
Michael Gehring 2014-11-20 20:36:50 +01:00
parent ef68edfa49
commit 92093644bb

View file

@ -145,7 +145,7 @@ fn verify_mode(mode: &str) -> Result<(), String> {
Ok(())
}
fn chmod(files: Vec<String>, changes: bool, quiet: bool, verbose: bool, preserve_root: bool, recursive: bool, fmode: Option<u32>, cmode: Option<&String>) -> Result<(), int> {
fn chmod(files: Vec<String>, changes: bool, quiet: bool, verbose: bool, preserve_root: bool, recursive: bool, fmode: Option<libc::mode_t>, cmode: Option<&String>) -> Result<(), int> {
let mut r = Ok(());
for filename in files.iter() {
@ -181,7 +181,7 @@ fn chmod(files: Vec<String>, changes: bool, quiet: bool, verbose: bool, preserve
r
}
fn chmod_file(file: &Path, name: &str, changes: bool, quiet: bool, verbose: bool, fmode: Option<u32>, cmode: Option<&String>) -> Result<(), int> {
fn chmod_file(file: &Path, name: &str, changes: bool, quiet: bool, verbose: bool, fmode: Option<libc::mode_t>, cmode: Option<&String>) -> Result<(), int> {
let path = name.to_c_str();
match fmode {
Some(mode) => {
@ -279,7 +279,7 @@ fn chmod_file(file: &Path, name: &str, changes: bool, quiet: bool, verbose: bool
'+' | '-' | '=' => (ch, change.slice_from(1)),
_ => ('=', change)
};
let mode = from_str_radix::<u32>(slice, 8).unwrap(); // already verified
let mode = from_str_radix::<u32>(slice, 8).unwrap() as libc::mode_t; // already verified
match action {
'+' => fperm |= mode,
'-' => fperm &= !mode,