From 1ade6874e579fd9a09512dd509976a2b35439d9e Mon Sep 17 00:00:00 2001 From: Enwei Jiao Date: Sat, 21 Oct 2023 08:55:56 +0800 Subject: [PATCH] Fix read result not full (#3350) Signed-off-by: Enwei Jiao --- bindings/c/src/types.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bindings/c/src/types.rs b/bindings/c/src/types.rs index 19c9365ca220..e58b2e842128 100644 --- a/bindings/c/src/types.rs +++ b/bindings/c/src/types.rs @@ -441,10 +441,11 @@ impl opendal_reader { panic!("The buffer given is pointing at NULL"); } let buf = unsafe { std::slice::from_raw_parts_mut(buf, len) }; - let r = (*self.inner).read(buf); + let r = (*self.inner).read_exact(buf); + match r { - Ok(n) => opendal_result_reader_read { - size: n, + Ok(_) => opendal_result_reader_read { + size: len, error: std::ptr::null_mut(), }, Err(e) => {