From 7bf6e46688b3d8180f1d3d5ba46b41d7f9523788 Mon Sep 17 00:00:00 2001 From: Johnathan Sharratt Date: Fri, 15 Mar 2024 00:39:38 +1100 Subject: [PATCH] Fix for a panic in the sock_recv when a file handle is missing --- lib/wasix/src/syscalls/wasix/sock_recv.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/wasix/src/syscalls/wasix/sock_recv.rs b/lib/wasix/src/syscalls/wasix/sock_recv.rs index 0dfafd09c2c..565a80e3f06 100644 --- a/lib/wasix/src/syscalls/wasix/sock_recv.rs +++ b/lib/wasix/src/syscalls/wasix/sock_recv.rs @@ -27,7 +27,7 @@ pub fn sock_recv( ro_flags: WasmPtr, ) -> Result { let env = ctx.data(); - let fd_entry = env.state.fs.get_fd(sock).unwrap(); + let fd_entry = wasi_try_ok!(env.state.fs.get_fd(sock)); let guard = fd_entry.inode.read(); let use_read = matches!(guard.deref(), Kind::Pipe { .. }); drop(guard);