Skip to content

Commit 43c230d

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 43c230d

1 file changed

Lines changed: 0 additions & 46 deletions

File tree

  • crates/libafl_bolts/src

crates/libafl_bolts/src/os.rs

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -65,52 +65,6 @@ pub fn last_os_error() -> i32 {
6565
std::io::Error::last_os_error().raw_os_error().unwrap_or(0)
6666
}
6767

68-
/// Returns the last OS error (errno).
69-
///
70-
/// Currently supported on `no_std`:
71-
/// * Linux
72-
/// * Android
73-
/// * macOS
74-
/// * FreeBSD
75-
/// * Dragonfly
76-
/// * OpenBSD
77-
/// * NetBSD
78-
#[must_use]
79-
#[cfg(all(
80-
not(feature = "std"),
81-
any(
82-
target_os = "linux",
83-
target_os = "android",
84-
target_os = "macos",
85-
target_os = "freebsd",
86-
target_os = "dragonfly",
87-
target_os = "openbsd",
88-
target_os = "netbsd"
89-
)
90-
))]
91-
pub fn last_os_error() -> i32 {
92-
unsafe {
93-
#[cfg(target_os = "linux")]
94-
{
95-
*libc::__errno_location()
96-
}
97-
#[cfg(target_os = "android")]
98-
{
99-
*libc::__errno()
100-
}
101-
#[cfg(any(
102-
target_os = "macos",
103-
target_os = "freebsd",
104-
target_os = "dragonfly",
105-
target_os = "openbsd",
106-
target_os = "netbsd"
107-
))]
108-
{
109-
*libc::__error()
110-
}
111-
}
112-
}
113-
11468
/// Waits for a pid and returns the status
11569
#[must_use]
11670
#[cfg(unix)]

0 commit comments

Comments
 (0)