Skip to content

Commit

Permalink
Merge #3093
Browse files Browse the repository at this point in the history
3093: Fixed a potential issue when renaming a file r=ptitSeb a=ptitSeb

Fixed a potential issue when renaming a file and the destination is from a preopened dir and already exist (for #3084)


Co-authored-by: ptitSeb <[email protected]>
  • Loading branch information
bors[bot] and ptitSeb authored Aug 11, 2022
2 parents cc3cdcd + b26885f commit fcf476e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/wasi/src/syscalls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2656,6 +2656,18 @@ pub fn path_rename<M: MemorySize>(
source_path.to_str().as_ref().unwrap(),
true
));
if state
.fs
.get_inode_at_path(
inodes.deref_mut(),
new_fd,
target_path.to_str().as_ref().unwrap(),
true,
)
.is_ok()
{
return __WASI_EEXIST;
}
let (source_parent_inode, source_entry_name) =
wasi_try!(state
.fs
Expand Down

0 comments on commit fcf476e

Please sign in to comment.