From: Stefan Schantl Date: Fri, 16 Apr 2021 18:27:20 +0000 (+0200) Subject: ids-functions.pl: Proper return N/A if no ruleset date could be X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=057e89535108ea3afa67e469fd73c0cce619e307;p=people%2Fstevee%2Fipfire-2.x.git ids-functions.pl: Proper return N/A if no ruleset date could be determined. If no timestamp could be grabbed for rulestarball of a given provider, return N/A. Signed-off-by: Stefan Schantl --- diff --git a/config/cfgroot/ids-functions.pl b/config/cfgroot/ids-functions.pl index b2e1a55200..64d98a3882 100644 --- a/config/cfgroot/ids-functions.pl +++ b/config/cfgroot/ids-functions.pl @@ -1512,15 +1512,15 @@ sub get_ruleset_date($) { # Get timestamp the file creation. my $mtime = $stat->mtime; + # Check if the timestamp has not been grabbed. + unless ($mtime) { + # Return N/A for Not available. + return "N/A"; + } + # Convert into human read-able format. $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; }