Use chmod instead of fcntl to change file perms
This commit is contained in:
parent
2e5c821619
commit
267bc54fbd
1 changed files with 1 additions and 4 deletions
|
|
@ -387,10 +387,7 @@ pub fn rename(_old: &Path, _new: &Path) -> io::Result<()> {
|
|||
}
|
||||
|
||||
pub fn set_perm(p: &Path, perm: FilePermissions) -> io::Result<()> {
|
||||
let mut options = OpenOptions::new();
|
||||
options.read(true);
|
||||
let file = File::open(p, &options)?;
|
||||
cvt(libc::fcntl(file.0.raw(), libc::F_SETMODE, perm.mode as usize))?;
|
||||
cvt(libc::chmod(p.to_str().unwrap(), perm.mode as usize))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue