Skip to content

Commit

Permalink
use try_read_exact in verification phase
Browse files Browse the repository at this point in the history
  • Loading branch information
ifd3f committed Dec 7, 2024
1 parent fe13d6d commit bab823e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/writer_process/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,15 +298,15 @@ impl<S: Read, D: Read> VerifyOp<S, D> {

loop {
for _ in 0..self.checkpoint_period {
let read_bytes = file.read(&mut file_buf)?;
if read_bytes == 0 {
let file_read_bytes = try_read_exact(&mut file, &mut file_buf)?;
if file_read_bytes == 0 {
checkpoint!();
return Ok(());
}

disk.read_exact(&mut disk_buf)?;
let disk_read_bytes = try_read_exact(&mut disk, &mut disk_buf)?;

if file_buf[..read_bytes] != disk_buf[..read_bytes] {
if file_buf[..file_read_bytes] != disk_buf[..disk_read_bytes] {
return Err(ErrorType::VerificationFailed);
}
}
Expand Down

0 comments on commit bab823e

Please sign in to comment.