$OpenBSD: patch-library_std_src_sys_unix_os_rs,v 1.7 2021/09/09 15:07:40 semarie Exp $
argv0 isn't suitable as current_exe() in all cases.
Index: library/std/src/sys/unix/os.rs
--- library/std/src/sys/unix/os.rs.orig
+++ library/std/src/sys/unix/os.rs
@@ -325,14 +325,17 @@ pub fn current_exe() -> io::Result<PathBuf> {
         if argv[0].is_null() {
             return Err(io::Error::new_const(
                 io::ErrorKind::Uncategorized,
-                &"no current exe available",
+                &"no current exe available (null)",
             ));
         }
         let argv0 = CStr::from_ptr(argv[0]).to_bytes();
         if argv0[0] == b'.' || argv0.iter().any(|b| *b == b'/') {
             crate::fs::canonicalize(OsStr::from_bytes(argv0))
         } else {
-            Ok(PathBuf::from(OsStr::from_bytes(argv0)))
+            Err(io::Error::new_const(
+                io::ErrorKind::Uncategorized,
+                &"no current exe available (short)",
+            ))
         }
     }
 }
