Skip to content

Commit 63aa795

Browse files
committed
propagate IO errors when checking files' hashes
1 parent 2d1609c commit 63aa795

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

clang-installer/src/downloader/hashing.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ impl HashAlgorithm {
3434
use sha2::{Digest, Sha256};
3535

3636
let mut hasher = Sha256::new();
37-
while let Ok(bytes_read) = file_reader.read(&mut buf) {
37+
loop {
38+
let bytes_read = file_reader.read(&mut buf)?;
3839
if bytes_read == 0 {
3940
break;
4041
}
@@ -54,7 +55,8 @@ impl HashAlgorithm {
5455
use blake2::{Blake2b, Digest, digest::consts::U32};
5556

5657
let mut hasher = Blake2b::<U32>::new();
57-
while let Ok(bytes_read) = file_reader.read(&mut buf) {
58+
loop {
59+
let bytes_read = file_reader.read(&mut buf)?;
5860
if bytes_read == 0 {
5961
break;
6062
}
@@ -74,7 +76,9 @@ impl HashAlgorithm {
7476
use sha2::{Digest, Sha512};
7577

7678
let mut hasher = Sha512::new();
77-
while let Ok(bytes_read) = file_reader.read(&mut buf) {
79+
80+
loop {
81+
let bytes_read = file_reader.read(&mut buf)?;
7882
if bytes_read == 0 {
7983
break;
8084
}

0 commit comments

Comments
 (0)