Rename can be done with O_PATH

This commit is contained in:
Jeremy Soller
2019-04-06 20:47:20 -06:00
parent 54b6c8f025
commit 588f032f75
+1 -1
View File
@@ -889,7 +889,7 @@ impl Pal for Sys {
}
fn rename(oldpath: &CStr, newpath: &CStr) -> c_int {
match File::open(oldpath, fcntl::O_WRONLY | fcntl::O_CLOEXEC) {
match File::open(oldpath, fcntl::O_PATH | fcntl::O_CLOEXEC) {
Ok(file) => e(syscall::frename(*file as usize, newpath.to_bytes())) as c_int,
Err(_) => -1,
}