From: Stefan Schantl Date: Thu, 2 Dec 2021 06:44:52 +0000 (+0100) Subject: ids-functions.pl: Do not call stat if no file has been given. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d4d0a8e9d407f661561f46815a5beeaa1ec999d1;p=people%2Fstevee%2Fipfire-2.x.git ids-functions.pl: Do not call stat if no file has been given. Signed-off-by: Stefan Schantl --- diff --git a/config/cfgroot/ids-functions.pl b/config/cfgroot/ids-functions.pl index 8c2d6782f5..fc2625920b 100644 --- a/config/cfgroot/ids-functions.pl +++ b/config/cfgroot/ids-functions.pl @@ -1504,6 +1504,7 @@ END sub get_ruleset_date($) { my ($provider) = @_; my $date; + my $mtime; # Load neccessary perl modules for file stat and to format the timestamp. use File::stat; @@ -1512,11 +1513,14 @@ sub get_ruleset_date($) { # Get the stored rulesfile for this provider. my $stored_rulesfile = &_get_dl_rulesfile($provider); - # Call stat on the rulestarball. - my $stat = stat("$stored_rulesfile"); + # Check if we got a file. + if ($stored_rulesfile) { + # Call stat on the rulestarball. + my $stat = stat("$stored_rulesfile"); - # Get timestamp the file creation. - my $mtime = $stat->mtime; + # Get timestamp the file creation. + $mtime = $stat->mtime; + } # Check if the timestamp has not been grabbed. unless ($mtime) {