Skip to content

Commit

Permalink
Merge #3088
Browse files Browse the repository at this point in the history
3088: Fixed an issue when renaming a file from a preopened dir directly (for 3084) r=ptitSeb a=ptitSeb

# Description
Fixed an issue that could happens when renaming a file from a reopened folder
Fix #3084 

Co-authored-by: ptitSeb <[email protected]>
  • Loading branch information
bors[bot] and ptitSeb authored Aug 10, 2022
2 parents f0ed34c + 05dd3b7 commit b3c3df0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/wasi/src/syscalls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2649,6 +2649,13 @@ pub fn path_rename<M: MemorySize>(
}
}

// this is to be sure the source file is fetch from filesystem if needed
wasi_try!(state.fs.get_inode_at_path(
inodes.deref_mut(),
old_fd,
source_path.to_str().as_ref().unwrap(),
true
));
let (source_parent_inode, source_entry_name) =
wasi_try!(state
.fs
Expand All @@ -2657,7 +2664,6 @@ pub fn path_rename<M: MemorySize>(
wasi_try!(state
.fs
.get_parent_inode_at_path(inodes.deref_mut(), new_fd, target_path, true));

let host_adjusted_target_path = {
let guard = inodes.arena[target_parent_inode].read();
let deref = guard.deref();
Expand Down

0 comments on commit b3c3df0

Please sign in to comment.