You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by xy...@apache.org on 2023/10/21 00:56:00 UTC

[incubator-opendal] branch main updated: Fix read result not full (#3350)

This is an automated email from the ASF dual-hosted git repository.

xyji pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git


The following commit(s) were added to refs/heads/main by this push:
     new 1ade6874e Fix read result not full (#3350)
1ade6874e is described below

commit 1ade6874e579fd9a09512dd509976a2b35439d9e
Author: Enwei Jiao <en...@zilliz.com>
AuthorDate: Sat Oct 21 08:55:56 2023 +0800

    Fix read result not full (#3350)
    
    Signed-off-by: Enwei Jiao <en...@zilliz.com>
---
 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 19c9365ca..e58b2e842 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) => {