Skip to content

Commit 3e7755a

Browse files
author
Ilhan Raja
committed
feat: Fix no_std error for last_os_error() when libc is not available e.g. embedded targets
1 parent 0e72b72 commit 3e7755a

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

  • crates/libafl_bolts/src

crates/libafl_bolts/src/os.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ pub fn last_os_error() -> i32 {
8989
)
9090
))]
9191
pub fn last_os_error() -> i32 {
92+
#[cfg(unix)]
9293
unsafe {
9394
#[cfg(target_os = "linux")]
9495
{
@@ -109,6 +110,12 @@ pub fn last_os_error() -> i32 {
109110
*libc::__error()
110111
}
111112
}
113+
114+
// Fallback for no_std without unix
115+
#[cfg(not(unix))]
116+
{
117+
0
118+
}
112119
}
113120

114121
/// Waits for a pid and returns the status

0 commit comments

Comments
 (0)