From b356ac522fe9168337669f3c2a9e0b30163a5803 Mon Sep 17 00:00:00 2001 From: emma Date: Mon, 18 Mar 2024 20:45:53 -0600 Subject: [PATCH] strerror(3): changed panic to 0 --- src/strerror.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/strerror.rs b/src/strerror.rs index 01d98e2..e5a2a95 100644 --- a/src/strerror.rs +++ b/src/strerror.rs @@ -15,7 +15,7 @@ extern "C" { fn strerror(errnum: c_int) -> *mut c_char; } /* wrapper function for use in Rust */ pub fn raw_message(err: std::io::Error) -> String { /* Get the raw OS error. If it’s None, what the hell is going on‽ */ - let errno = err.raw_os_error().unwrap() as c_int; + let errno = err.raw_os_error().unwrap_or(0) as c_int; /* Get a CStr from the error message so that it’s referenced and then * convert it to an owned value. If the string is not valid UTF-8, return