fix: uncomment code to make lib functional until we refactor
This commit is contained in:
parent
76354f144a
commit
9280fb8d6d
18
src/lib.rs
18
src/lib.rs
|
@ -13,15 +13,26 @@ fn fakerand_value() -> Option<i32> {
|
|||
*FAKERAND.get_or_init(|| env::var("FAKERAND").ok().and_then(|v| v.parse().ok()))
|
||||
}
|
||||
|
||||
/*
|
||||
#[no_mangle]
|
||||
pub extern "C" fn rand() -> c_int {
|
||||
println!("rand() called");
|
||||
|
||||
if let Some(fakerand) = fakerand_value() {
|
||||
println!("rand() value {}", fakerand);
|
||||
return fakerand;
|
||||
}
|
||||
|
||||
// match fakerand_value() {
|
||||
// Some(n) => return n,
|
||||
// None => {
|
||||
// eprint!("fakerand loaded but unable to generate fake rand");
|
||||
// unsafe {
|
||||
// let errno = libc::__errno_location();
|
||||
// *errno = libc::EINVAL;
|
||||
// }
|
||||
// return -1;
|
||||
// }
|
||||
// };
|
||||
|
||||
unsafe {
|
||||
let symbol = dlsym(RTLD_NEXT, "rand\0".as_ptr() as *const _);
|
||||
|
||||
|
@ -34,7 +45,6 @@ pub extern "C" fn rand() -> c_int {
|
|||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
#[inline(always)]
|
||||
unsafe fn copy_slice_to_ptr(slice: &[u8], buf: *mut c_void, buf_size: usize) {
|
||||
|
@ -129,7 +139,6 @@ pub extern "C" fn read(fd: c_int, buf: *mut c_void, count: usize) -> ssize_t {
|
|||
original_read(fd, buf, count)
|
||||
}
|
||||
|
||||
/*
|
||||
/// # Safety
|
||||
///
|
||||
/// Checked by caller. This function may result in undefined behavior if buflen is longer than the
|
||||
|
@ -173,7 +182,6 @@ pub extern "C" fn RAND_bytes(buf: *mut c_uchar, num: c_int) -> c_int {
|
|||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
|
Loading…
Reference in New Issue