diff --git a/coverage_config_x86_64.json b/coverage_config_x86_64.json index 4ba52155..d1cb2ec9 100644 --- a/coverage_config_x86_64.json +++ b/coverage_config_x86_64.json @@ -1,5 +1,5 @@ { - "coverage_score": 87.5, + "coverage_score": 87.6, "exclude_path": "mmap_windows.rs", "crate_features": "backend-mmap,backend-atomic,backend-bitmap" } diff --git a/src/guest_memory.rs b/src/guest_memory.rs index 27772e36..a65531a0 100644 --- a/src/guest_memory.rs +++ b/src/guest_memory.rs @@ -853,16 +853,16 @@ impl Bytes for T { // record the dirty status of the written range below. let start = caddr.raw_value() as usize; let end = start + len; - let result = loop { + let bytes_read = loop { match src.read(&mut dst[start..end]) { - Ok(n) => break Ok(n), + Ok(n) => break n, Err(ref e) if e.kind() == std::io::ErrorKind::Interrupted => continue, - Err(e) => break Err(Error::IOError(e)), + Err(e) => return Err(Error::IOError(e)), } }; - region.bitmap().mark_dirty(start, len); - result + region.bitmap().mark_dirty(start, bytes_read); + Ok(bytes_read) } else { let len = std::cmp::min(len, MAX_ACCESS_CHUNK); let mut buf = vec![0u8; len].into_boxed_slice();