Skip to content

Commit 267bc54

Browse files
committed
Use chmod instead of fcntl to change file perms
1 parent 2e5c821 commit 267bc54

File tree

1 file changed

+1
-4
lines changed
  • src/libstd/sys/redox

1 file changed

+1
-4
lines changed

src/libstd/sys/redox/fs.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -387,10 +387,7 @@ pub fn rename(_old: &Path, _new: &Path) -> io::Result<()> {
387387
}
388388

389389
pub fn set_perm(p: &Path, perm: FilePermissions) -> io::Result<()> {
390-
let mut options = OpenOptions::new();
391-
options.read(true);
392-
let file = File::open(p, &options)?;
393-
cvt(libc::fcntl(file.0.raw(), libc::F_SETMODE, perm.mode as usize))?;
390+
cvt(libc::chmod(p.to_str().unwrap(), perm.mode as usize))?;
394391
Ok(())
395392
}
396393

0 commit comments

Comments
 (0)