From 1151fe39ab37f80e13174dd1bcfe53010272b5a7 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 15 Dec 2015 11:17:32 -0500 Subject: [PATCH] More debug lines, and use the default config.events_dir path when not specified otherwise --- src/zm_storage.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/zm_storage.cpp b/src/zm_storage.cpp index 6b2b1d71d..6a71482c9 100644 --- a/src/zm_storage.cpp +++ b/src/zm_storage.cpp @@ -29,7 +29,10 @@ Storage::Storage() { - id = name[0] = path[0] = 0; + Warning("Instantiating default Storage Object. Should not happen."); + id = 0; + strcpy(name, "Default"); + strncpy(path, config.dir_events, sizeof(path) ); } Storage::Storage( MYSQL_ROW &dbrow ) { @@ -41,10 +44,12 @@ Storage::Storage( MYSQL_ROW &dbrow ) { /* If a zero or invalid p_id is passed, then the old default path will be assumed. */ Storage::Storage( unsigned int p_id ) { + id = 0; if ( p_id ) { char sql[ZM_SQL_SML_BUFSIZ]; snprintf( sql, sizeof(sql), "SELECT Id, Name, Path from Storage WHERE Id=%d", p_id ); + Debug(1,"Loading Storage for %d using %s", p_id, sql ); MYSQL_ROW dbrow = zmDbFetchOne( sql ); if ( ! dbrow ) { Error( "Unable to load storage area for id %d: %s", p_id, mysql_error( &dbconn ) ); @@ -57,6 +62,7 @@ Storage::Storage( unsigned int p_id ) { } } if ( ! id ) { + Warning("No id passed to Storage constructor. Using default path %s instead", config.dir_events ); strcpy(name, "Default"); strncpy(path, config.dir_events, sizeof(path) ); }