suggested method to preserve intent of drop to fix error

However, I didn't write this library (and I don't have a test
suite for it), so I'm not quite sure if this preserves the
invariants on the fd_mapping() structure. Needs @xobs' review.
This commit is contained in:
bunnie 2023-07-16 17:58:40 +08:00
parent e2dacdce35
commit f0b351c2e0
2 changed files with 1 additions and 1 deletions

View file

@ -517,7 +517,6 @@ pub(crate) fn close_key(
return Err(crate::PddbRetcode::UnexpectedEof);
}
};
core::mem::drop(file);
// If this SID is unused, close the connection.
if let Some(cid) = conn {

View file

@ -1096,6 +1096,7 @@ fn wrapped_main() -> ! {
if let Err(e) = result {
xous::return_scalar(msg.sender, e as usize)
} else {
fd_mapping.remove(&msg.sender.pid());
xous::return_scalar2(msg.sender, 0, 0)
}.ok();
}