From dcd05d4cb9780b7ab6753de5267bc59d834d8022 Mon Sep 17 00:00:00 2001 From: Colin Ihrig Date: Tue, 12 Jul 2022 11:53:53 -0400 Subject: [PATCH] fix(net): don't panic on failed UDS removal (#15157) If a Unix Domain Socket cannot be removed, throw instead of panicing. Fixes: https://github.com/denoland/deno/issues/14213 --- ext/net/ops_unix.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/net/ops_unix.rs b/ext/net/ops_unix.rs index 4f03ecb0a3..c47102400f 100644 --- a/ext/net/ops_unix.rs +++ b/ext/net/ops_unix.rs @@ -144,7 +144,7 @@ pub fn listen_unix( addr: &Path, ) -> Result<(u32, tokio::net::unix::SocketAddr), AnyError> { if addr.exists() { - remove_file(&addr).unwrap(); + remove_file(&addr)?; } let listener = UnixListener::bind(&addr)?; let local_addr = listener.local_addr()?; @@ -162,7 +162,7 @@ pub fn listen_unix_packet( addr: &Path, ) -> Result<(u32, tokio::net::unix::SocketAddr), AnyError> { if addr.exists() { - remove_file(&addr).unwrap(); + remove_file(&addr)?; } let socket = UnixDatagram::bind(&addr)?; let local_addr = socket.local_addr()?;