Skip to content

Commit ddf1164

Browse files
committed
fix error handling on openbsd too
1 parent a8852bf commit ddf1164

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/guess_os_stack_limit/openbsd.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
pub unsafe fn guess_os_stack_limit() -> Option<usize> {
22
let mut stackinfo = std::mem::MaybeUninit::<libc::stack_t>::uninit();
3-
assert_eq!(
4-
libc::pthread_stackseg_np(libc::pthread_self(), stackinfo.as_mut_ptr()),
5-
0
6-
);
3+
let res = libc::pthread_stackseg_np(libc::pthread_self(), stackinfo.as_mut_ptr());
4+
if res != 0 {
5+
return None;
6+
}
77
Some(stackinfo.assume_init().ss_sp as usize - stackinfo.assume_init().ss_size)
88
}

0 commit comments

Comments
 (0)