Merge pull request #14921 from paul-szczepanek-arm/fix-ble-default-db

BLE: suppress error when no path is passed in for ble security db
pull/14941/head
Martin Kojtal 2021-07-20 10:02:28 +02:00 committed by GitHub
commit c9234177c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 2 deletions

View File

@ -1210,15 +1210,23 @@ ble_error_t SecurityManager::init_database(
const char *db_path const char *db_path
) )
{ {
tr_info("Initialize database. Path = %s", db_path); tr_info("Initialize database.");
delete _db; delete _db;
#if BLE_SECURITY_DATABASE_FILESYSTEM #if BLE_SECURITY_DATABASE_FILESYSTEM
FILE* db_file = FileSecurityDb::open_db_file(db_path); FILE* db_file = nullptr;
if (db_path) {
tr_info("Using filesystem path = %s", db_path);
db_file = FileSecurityDb::open_db_file(db_path);
}
if (db_file) { if (db_file) {
_db = new (std::nothrow) FileSecurityDb(db_file); _db = new (std::nothrow) FileSecurityDb(db_file);
} else } else
#else
if (db_path) {
tr_error("Passed in a path for BLE security DB init but BLE_SECURITY_DATABASE_FILESYSTEM is disabled");
}
#endif #endif
#if BLE_SECURITY_DATABASE_KVSTORE #if BLE_SECURITY_DATABASE_KVSTORE
if (KVStoreSecurityDb::open_db()) { if (KVStoreSecurityDb::open_db()) {