Skip to content

Commit

Permalink
Fix read result not full (#3350)
Browse files Browse the repository at this point in the history
Signed-off-by: Enwei Jiao <[email protected]>
  • Loading branch information
jiaoew1991 authored Oct 21, 2023
1 parent c52061a commit 1ade687
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions bindings/c/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit 1ade687

Please sign in to comment.