From 617c893471106a535ee4f9fd0ad62f1b330d2afa Mon Sep 17 00:00:00 2001 From: Andreas Romeyke <art1@andreas-romeyke.de> Date: Fri, 9 Oct 2020 11:22:59 +0200 Subject: [PATCH] - avoid fixity- and size check if files does not exist --- deep_fixitycheck.pl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/deep_fixitycheck.pl b/deep_fixitycheck.pl index 611721c..bd554f5 100644 --- a/deep_fixitycheck.pl +++ b/deep_fixitycheck.pl @@ -322,10 +322,12 @@ if (defined $search_dir && -d "$search_dir") { my $result; $result->{errors} = 0; $result = check_if_file_exist($fileobj, $result); - $result = check_file_size($fileobj, $result); - foreach my $fixity_algorithm ( @algorithms) { - if ($fileobj->{fixity}->{$fixity_algorithm}) { - $result = check_file_fixity($fileobj, $result, $fixity_algorithm); + if ($result->{exist}) { # only if file exists, do additional checks + $result = check_file_size($fileobj, $result); + foreach my $fixity_algorithm (@algorithms) { + if ($fileobj->{fixity}->{$fixity_algorithm}) { + $result = check_file_fixity($fileobj, $result, $fixity_algorithm); + } } } if ($result->{errors} > 0) { -- GitLab