From 057e89535108ea3afa67e469fd73c0cce619e307 Mon Sep 17 00:00:00 2001 From: Stefan Schantl Date: Fri, 16 Apr 2021 20:27:20 +0200 Subject: [PATCH] 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 --- config/cfgroot/ids-functions.pl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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; } -- 2.39.5