]> git.ipfire.org Git - people/stevee/ipfire-2.x.git/commitdiff
ids-functions.pl: Do not call stat if no file has been given.
authorStefan Schantl <stefan.schantl@ipfire.org>
Thu, 2 Dec 2021 06:44:52 +0000 (07:44 +0100)
committerStefan Schantl <stefan.schantl@ipfire.org>
Sun, 19 Dec 2021 12:25:46 +0000 (13:25 +0100)
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
config/cfgroot/ids-functions.pl

index 8c2d6782f5a30ac0bdb7a693b557477e49d1fe08..fc2625920be08ffc0ce7b819a533a460aaee724e 100644 (file)
@@ -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) {