Skip to content

Commit

Permalink
Better error handling of the actual amount written
Browse files Browse the repository at this point in the history
  • Loading branch information
john-sharratt committed Jul 21, 2024
1 parent de9e992 commit f8d4cc6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/wasix/src/syscalls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,9 @@ pub(crate) fn copy_from_slice<M: MemorySize>(
break;
}
let (left, right) = read_loc.split_at(to_read);
if buf.copy_from_slice_min(left) != to_read {
return Ok(bytes_read);
let amt = buf.copy_from_slice_min(left);
if amt != to_read {
return Ok(bytes_read + amt);
}

read_loc = right;
Expand Down

0 comments on commit f8d4cc6

Please sign in to comment.