From a04128961a10abc5bd3ad723892af94120f832a7 Mon Sep 17 00:00:00 2001 From: Vladimir Stackov Date: Fri, 23 Jan 2015 15:08:02 +0300 Subject: [PATCH] Respect options on storage initialization --- zbackup.cc | 3 ++- zbackup_base.cc | 4 +++- zbackup_base.hh | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/zbackup.cc b/zbackup.cc index c990126..fabec50 100644 --- a/zbackup.cc +++ b/zbackup.cc @@ -505,7 +505,8 @@ invalid_option: return EXIT_FAILURE; } - ZBackup::initStorage( args[ 1 ], passwords[ 0 ], !passwords[ 0 ].empty() ); + ZBackup::initStorage( args[ 1 ], + passwords[ 0 ], !passwords[ 0 ].empty(), config ); } else if ( strcmp( args[ 0 ], "backup" ) == 0 ) diff --git a/zbackup_base.cc b/zbackup_base.cc index c1a5614..0bc2fad 100644 --- a/zbackup_base.cc +++ b/zbackup_base.cc @@ -180,12 +180,14 @@ ExtendedStorageInfo ZBackupBase::loadExtendedStorageInfo( void ZBackupBase::initStorage( string const & storageDir, string const & password, - bool isEncrypted ) + bool isEncrypted, + Config const & configIn ) { StorageInfo storageInfo; ExtendedStorageInfo extendedStorageInfo; Config config( extendedStorageInfo.mutable_config() ); config.reset_storable(); + config.storable->MergeFrom( *configIn.storable ); EncryptionKey encryptionkey = EncryptionKey::noKey(); diff --git a/zbackup_base.hh b/zbackup_base.hh index 79c645d..95b437c 100644 --- a/zbackup_base.hh +++ b/zbackup_base.hh @@ -51,7 +51,7 @@ public: /// Creates new storage static void initStorage( std::string const & storageDir, std::string const & password, - bool isEncrypted ); + bool isEncrypted, Config const & ); /// For a given file within the backups/ dir in the storage, returns its /// storage dir or throws an exception