Skip to content

Commit 6e5875a

Browse files
committed
Fix rados_async_object_read
The set_len part was missed out when this was written.
1 parent e2eb9dc commit 6e5875a

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

Diff for: src/ceph.rs

+15-2
Original file line numberDiff line numberDiff line change
@@ -1049,7 +1049,7 @@ impl IoCtx {
10491049
fill_buffer.reserve_exact(DEFAULT_READ_BYTES);
10501050
}
10511051

1052-
with_completion(self, |c| unsafe {
1052+
let result = with_completion(self, |c| unsafe {
10531053
rados_aio_read(
10541054
self.ioctx,
10551055
obj_name_str.as_ptr(),
@@ -1059,7 +1059,20 @@ impl IoCtx {
10591059
read_offset,
10601060
)
10611061
})?
1062-
.await
1062+
.await;
1063+
1064+
if let Ok(rval) = &result {
1065+
unsafe {
1066+
// Completion should have handled any negative (error) values already
1067+
assert!(*rval >= 0);
1068+
1069+
let len = *rval as usize;
1070+
assert!(len <= fill_buffer.capacity());
1071+
fill_buffer.set_len(len);
1072+
}
1073+
}
1074+
1075+
result
10631076
}
10641077

10651078
/// Get object stats (size,SystemTime)

0 commit comments

Comments
 (0)