about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMartin Kröning <martin.kroening@eonerc.rwth-aachen.de>2025-09-10 15:26:59 +0200
committerMartin Kröning <martin.kroening@eonerc.rwth-aachen.de>2025-09-11 09:05:17 +0200
commitaf5355cc91fb48ed3d1bf31200b4311f801d24a6 (patch)
tree564f56735374a49867d941d38038b71234c87b5d
parent9fe101b6ea204256bffef357c646012d571416ee (diff)
downloadrust-af5355cc91fb48ed3d1bf31200b4311f801d24a6.tar.gz
rust-af5355cc91fb48ed3d1bf31200b4311f801d24a6.zip
Implement `Socket::take_error` for Hermit
-rw-r--r--library/std/src/sys/net/connection/socket/hermit.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/library/std/src/sys/net/connection/socket/hermit.rs b/library/std/src/sys/net/connection/socket/hermit.rs
index f49821657d9..5200eaa5786 100644
--- a/library/std/src/sys/net/connection/socket/hermit.rs
+++ b/library/std/src/sys/net/connection/socket/hermit.rs
@@ -304,7 +304,8 @@ impl Socket {
     }
 
     pub fn take_error(&self) -> io::Result<Option<io::Error>> {
-        unimplemented!()
+        let raw: c_int = getsockopt(self, libc::SOL_SOCKET, libc::SO_ERROR)?;
+        if raw == 0 { Ok(None) } else { Ok(Some(io::Error::from_raw_os_error(raw as i32))) }
     }
 
     // This is used by sys_common code to abstract over Windows and Unix.