]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #2663 in SNORT/snort3 from ~DIPANDIT/snort3:file_stat to master
authorBhargava Jandhyala (bjandhya) <bjandhya@cisco.com>
Fri, 11 Dec 2020 13:02:48 +0000 (13:02 +0000)
committerBhargava Jandhyala (bjandhya) <bjandhya@cisco.com>
Fri, 11 Dec 2020 13:02:48 +0000 (13:02 +0000)
Squashed commit of the following:

commit 55bed1f3cba5e8cdedc29e044bb1d802618aaa62
Author: Dipto Pandit <dipandit@cisco.com>
Date:   Thu Dec 10 05:31:04 2020 -0500

    file_api: fixed stats which weren't cleared when there were no stats for signature processing

src/file_api/file_stats.cc

index a6daf47371c3ef5af0e7fb4f531ec20dddd16b2f..237f93d7e8da1a5b3dcd851e3bb4bc68e19513a6 100644 (file)
@@ -81,7 +81,10 @@ void file_stats_print()
     }
 
     if ( !check_total )
+    {
+        memset(&file_totals,0,sizeof(file_totals));
         return;
+    }
 
     LogLabel("File Statistics");
     LogLabel("file type stats (files)");
@@ -143,7 +146,10 @@ void file_stats_print()
     }
 
     if ( !check_total )
+    {
+        memset(&file_totals,0,sizeof(file_totals));
         return;
+    }
 
     LogLabel("file signature stats");
 
@@ -167,8 +173,6 @@ void file_stats_print()
     LogMessage("            Total          " FMTu64("-10") " " FMTu64("-10") " \n",
         processed_total[0], processed_total[1]);
 
-    memset(&file_totals,0,sizeof(file_totals));
-
 #if 0
     LogLabel("file type verdicts");  // FIXIT-RC should be fixed
 
@@ -279,5 +283,6 @@ void file_stats_print()
 #endif
     // these are global / shared by all threads
     FileCapture::print_mem_usage();
+    memset(&file_totals,0,sizeof(file_totals));
 }