use unsafe to mark reopen_with_fdflags as having special safety features

This commit is contained in:
Pat Hickey
2021-01-21 18:08:15 -08:00
parent 69b7352332
commit 9e0d295f8c
5 changed files with 15 additions and 7 deletions

View File

@@ -276,7 +276,10 @@ impl<'a> wasi_snapshot_preview1::WasiSnapshotPreview1 for WasiCtx {
let fd = u32::from(fd);
let table_check = table.get_file(fd)?.get_cap(FileCaps::FDSTAT_SET_FLAGS)?;
drop(table_check);
table.update_file_in_place(fd, |f| f.reopen_with_fdflags(FdFlags::from(&flags)))
table.update_file_in_place(fd, |f| unsafe {
// Safety: update_file_in_place will drop `f` after this call.
f.reopen_with_fdflags(FdFlags::from(&flags))
})
}
fn fd_fdstat_set_rights(