From 224e261ade2694ef692b6f6fb89f811abe17c311 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 4 Jan 2018 17:16:15 -0500 Subject: [PATCH] Don't run audit on default storage area. Add a test for an event having no endtime --- scripts/zmaudit.pl.in | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/scripts/zmaudit.pl.in b/scripts/zmaudit.pl.in index a05d631be..39f5cdaee 100644 --- a/scripts/zmaudit.pl.in +++ b/scripts/zmaudit.pl.in @@ -172,7 +172,6 @@ MAIN: while( $loop ) { foreach my $Storage ( ZoneMinder::Storage->find( ($Config{ZM_SERVER_ID} ? ( ServerId => $Config{ZM_SERVER_ID} ) : () ) ), - new ZoneMinder::Storage(), ) { Debug('Checking events in ' . $Storage->Path() ); if ( ! chdir( $Storage->Path() ) ) { @@ -362,8 +361,18 @@ Debug("Event $db_event is not in fs."); } next; } + if ( ! $Event->EndTime() ) { + Debug("Event $$Event{Id} has no end time. deleting it."); + if ( $age > $Config{ZM_AUDIT_MIN_AGE} ) { + if ( confirm() ) { + $Event->delete(); + $cleaned = 1; + } + next; + } + } if ( $Event->check_for_in_filesystem() ) { - Debug('Database events apparently exists at ' . $Event->Path() ); + Debug("Database event $$Event{Id} apparently exists at " . $Event->Path() ); } else { if ( $age > $Config{ZM_AUDIT_MIN_AGE} ) { aud_print( "Database event '$db_monitor/$db_event' does not exist at " . $Event->Path().' in filesystem' );