Skip to content

Commit af5355c

Browse files
committed
Implement Socket::take_error for Hermit
1 parent 9fe101b commit af5355c

File tree

1 file changed

+2
-1
lines changed
  • library/std/src/sys/net/connection/socket

1 file changed

+2
-1
lines changed

library/std/src/sys/net/connection/socket/hermit.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,8 @@ impl Socket {
304304
}
305305

306306
pub fn take_error(&self) -> io::Result<Option<io::Error>> {
307-
unimplemented!()
307+
let raw: c_int = getsockopt(self, libc::SOL_SOCKET, libc::SO_ERROR)?;
308+
if raw == 0 { Ok(None) } else { Ok(Some(io::Error::from_raw_os_error(raw as i32))) }
308309
}
309310

310311
// This is used by sys_common code to abstract over Windows and Unix.

0 commit comments

Comments
 (0)