diff --git a/leechcore-sys/build.rs b/leechcore-sys/build.rs index 8c8d32f..375063c 100644 --- a/leechcore-sys/build.rs +++ b/leechcore-sys/build.rs @@ -47,7 +47,8 @@ fn build_leechcore(target: &str) { .map(|o| "src/leechcore/leechcore/".to_string() + o) .collect::>(), ) - .flag(&format!("-D{}", os_define())); + .flag(&format!("-D{}", os_define())) + .flag("-D_GNU_SOURCE"); // EXPORTED_FUNCTION= to not export any symbols if !target.contains("windows") { @@ -105,7 +106,7 @@ fn main() { // generate bindings let mut builder = bindgen::builder() - .clang_arg(format!("-D{}", os_define())) + .clang_arg(format!("-D{} -D_GNU_SOURCE", os_define())) .header("./src/leechcore/leechcore/leechcore.h"); // workaround for windows.h diff --git a/leechcore-sys/src/leechcore b/leechcore-sys/src/leechcore index e31a508..9968fa3 160000 --- a/leechcore-sys/src/leechcore +++ b/leechcore-sys/src/leechcore @@ -1 +1 @@ -Subproject commit e31a5084e264b4ab3c21238a95f703e994ec3384 +Subproject commit 9968fa3d88b3504c0ac68c582f111929afefd103 diff --git a/memflow-pcileech/src/lib.rs b/memflow-pcileech/src/lib.rs index 161ff56..df7abb8 100644 --- a/memflow-pcileech/src/lib.rs +++ b/memflow-pcileech/src/lib.rs @@ -92,9 +92,8 @@ impl PciLeech { if handle.is_null() { // TODO: handle version error // TODO: handle special case of fUserInputRequest - error!("leechcore error: {:?}", err); return Err(Error(ErrorOrigin::Connector, ErrorKind::Configuration) - .log_error("unable to create leechcore context")); + .log_error(&format!("unable to create leechcore context: {:?}", err))); } Ok(Self { @@ -361,10 +360,13 @@ pub fn create_connector(args: &Args, log_level: Level) -> Result { match validator.validate(&args) { Ok(_) => { - let device = args.get("device").or_else(|| args.get_default()).ok_or( - Error(ErrorOrigin::Connector, ErrorKind::ArgValidation) - .log_error("'device' argument is missing"), - )?; + let device = args + .get("device") + .or_else(|| args.get_default()) + .ok_or_else(|| { + Error(ErrorOrigin::Connector, ErrorKind::ArgValidation) + .log_error("'device' argument is missing") + })?; if let Some(memmap) = args.get("memmap") { PciLeech::with_memmap(device, memmap)