From 7dccbac78d295bc2076ce63d52e2ece9aca6337b Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 19 May 2017 14:25:44 -0400 Subject: [PATCH] clenaup --- src/zm_event.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/zm_event.cpp b/src/zm_event.cpp index b33925070..c79a0339a 100644 --- a/src/zm_event.cpp +++ b/src/zm_event.cpp @@ -115,7 +115,6 @@ Event::Event( Monitor *p_monitor, struct timeval p_start_time, const std::string tot_score = 0; max_score = 0; - char id_file[PATH_MAX]; struct stat statbuf; if ( config.use_deep_storage ) { @@ -157,7 +156,7 @@ Event::Event( Monitor *p_monitor, struct timeval p_start_time, const std::string snprintf( id_file, sizeof(id_file), "%s/.%d", date_path, id ); if ( symlink( time_path, id_file ) < 0 ) Fatal( "Can't symlink %s -> %s: %s", id_file, path, strerror(errno)); - // Create empty id tag file + } else { snprintf( path, sizeof(path), "%s/%d/%d", storage->Path(), monitor->Id(), id ); @@ -170,12 +169,15 @@ Event::Event( Monitor *p_monitor, struct timeval p_start_time, const std::string } } // deep storage or not - // Create empty id tag file - snprintf( id_file, sizeof(id_file), "%s/.%d", path, id ); - if ( FILE *id_fp = fopen( id_file, "w" ) ) - fclose( id_fp ); - else - Fatal( "Can't fopen %s: %s", id_file, strerror(errno)); + { + char id_file[PATH_MAX]; + // Create empty id tag file + snprintf( id_file, sizeof(id_file), "%s/.%d", path, id ); + if ( FILE *id_fp = fopen( id_file, "w" ) ) + fclose( id_fp ); + else + Fatal( "Can't fopen %s: %s", id_file, strerror(errno)); + } last_db_frame = 0;