]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
ids-functions.pl: Return N/A if not date for a ruleset could be
authorStefan Schantl <stefan.schantl@ipfire.org>
Wed, 14 Apr 2021 18:37:50 +0000 (20:37 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Sun, 19 Dec 2021 12:23:45 +0000 (13:23 +0100)
determined.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
config/cfgroot/ids-functions.pl

index 2af5534c95620344be687608e4aa409c1f1f0ec8..b2e1a55200f295e9425f234b8e35603f696f4706 100644 (file)
@@ -1497,6 +1497,7 @@ END
 #
 sub get_ruleset_date($) {
        my ($provider) = @_;
+       my $date;
 
        # Load neccessary perl modules for file stat and to format the timestamp.
        use File::stat;
@@ -1512,7 +1513,13 @@ sub get_ruleset_date($) {
        my $mtime = $stat->mtime;
 
        # Convert into human read-able format.
-       my $date = strftime('%Y-%m-%d %H:%M:%S', localtime($mtime));
+       $date = strftime('%Y-%m-%d %H:%M:%S', localtime($mtime));
+
+       # Check if a date has been obtained.
+       unless ($date) {
+               # Assign N/A for Not available.
+               $date = "N/A";
+       }
 
        # Return the date.
        return $date;