Skip to content

Commit 18a552e

Browse files
committed
Fixed an issue when renaming a file from a preopened dir directly (for #3084)
1 parent a6ddf4e commit 18a552e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/wasi/src/syscalls/mod.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -2649,6 +2649,13 @@ pub fn path_rename<M: MemorySize>(
26492649
}
26502650
}
26512651

2652+
// this is to be sure the source file is fetch from filesystem if needed
2653+
wasi_try!(state.fs.get_inode_at_path(
2654+
inodes.deref_mut(),
2655+
old_fd,
2656+
source_path.to_str().as_ref().unwrap(),
2657+
true
2658+
));
26522659
let (source_parent_inode, source_entry_name) =
26532660
wasi_try!(state
26542661
.fs
@@ -2657,7 +2664,6 @@ pub fn path_rename<M: MemorySize>(
26572664
wasi_try!(state
26582665
.fs
26592666
.get_parent_inode_at_path(inodes.deref_mut(), new_fd, target_path, true));
2660-
26612667
let host_adjusted_target_path = {
26622668
let guard = inodes.arena[target_parent_inode].read();
26632669
let deref = guard.deref();

0 commit comments

Comments
 (0)