This commit is contained in:
Isaac Connor 2017-05-19 14:25:44 -04:00
parent 61204a8b83
commit 7dccbac78d
1 changed files with 10 additions and 8 deletions

View File

@ -115,7 +115,6 @@ Event::Event( Monitor *p_monitor, struct timeval p_start_time, const std::string
tot_score = 0; tot_score = 0;
max_score = 0; max_score = 0;
char id_file[PATH_MAX];
struct stat statbuf; struct stat statbuf;
if ( config.use_deep_storage ) { 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 ); snprintf( id_file, sizeof(id_file), "%s/.%d", date_path, id );
if ( symlink( time_path, id_file ) < 0 ) if ( symlink( time_path, id_file ) < 0 )
Fatal( "Can't symlink %s -> %s: %s", id_file, path, strerror(errno)); Fatal( "Can't symlink %s -> %s: %s", id_file, path, strerror(errno));
// Create empty id tag file
} else { } else {
snprintf( path, sizeof(path), "%s/%d/%d", storage->Path(), monitor->Id(), id ); 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 } // deep storage or not
// Create empty id tag file {
snprintf( id_file, sizeof(id_file), "%s/.%d", path, id ); char id_file[PATH_MAX];
if ( FILE *id_fp = fopen( id_file, "w" ) ) // Create empty id tag file
fclose( id_fp ); snprintf( id_file, sizeof(id_file), "%s/.%d", path, id );
else if ( FILE *id_fp = fopen( id_file, "w" ) )
Fatal( "Can't fopen %s: %s", id_file, strerror(errno)); fclose( id_fp );
else
Fatal( "Can't fopen %s: %s", id_file, strerror(errno));
}
last_db_frame = 0; last_db_frame = 0;