File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed
src/uucore/src/lib/features/checksum Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -676,8 +676,26 @@ fn compute_and_check_digest_from_file(
676676
677677 // TODO: improve function signature to use ReadingMode instead of binary bool
678678 // Set binary to false because --binary is not supported with --check
679- let ( calculated_checksum, _) =
680- digest_reader ( & mut digest, & mut file_reader, /* binary */ false ) . unwrap ( ) ;
679+
680+ let ( calculated_checksum, _) = match digest_reader ( & mut digest, & mut file_reader, false ) {
681+ Ok ( result) => result,
682+ Err ( err) => {
683+ show ! ( err. map_err_context( || {
684+ locale_aware_escape_name( & real_filename_to_check, QuotingStyle :: SHELL_ESCAPE )
685+ . to_string_lossy( )
686+ . to_string( )
687+ } ) ) ;
688+
689+ print_file_report (
690+ std:: io:: stdout ( ) ,
691+ filename,
692+ FileChecksumResult :: CantOpen ,
693+ prefix,
694+ opts. verbose ,
695+ ) ;
696+ return Err ( LineCheckError :: CantOpenFile ) ;
697+ }
698+ } ;
681699
682700 // Do the checksum validation
683701 let checksum_correct = match calculated_checksum {
You can’t perform that action at this time.
0 commit comments