From ef861cbbcfabe6d858455d30adade8b1e3d9eea8 Mon Sep 17 00:00:00 2001 From: Dominik Maier Date: Thu, 4 Mar 2021 19:32:41 +0100 Subject: [PATCH] fixed no_std --- libafl/src/utils.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libafl/src/utils.rs b/libafl/src/utils.rs index bcd90fd07d..9bdeef2b3b 100644 --- a/libafl/src/utils.rs +++ b/libafl/src/utils.rs @@ -6,11 +6,8 @@ use xxhash_rust::xxh3::xxh3_64_with_seed; #[cfg(unix)] use libc::pid_t; -#[cfg(unix)] +#[cfg(all(unix, feature = "std"))] use std::ffi::CString; - -use crate::Error; - #[cfg(feature = "std")] use std::{ env, @@ -18,6 +15,9 @@ use std::{ time::{SystemTime, UNIX_EPOCH}, }; +#[cfg(feature = "std")] +use crate::Error; + pub trait AsSlice { /// Convert to a slice fn as_slice(&self) -> &[T]; @@ -417,7 +417,7 @@ pub enum ForkResult { /// Unix has forks. /// # Safety /// A Normal fork. Runs on in two processes. Should be memory safe in general. -#[cfg(unix)] +#[cfg(all(unix, feature = "std"))] pub unsafe fn fork() -> Result { match libc::fork() { pid if pid > 0 => Ok(ForkResult::Parent(ChildHandle { pid })),