From 22cb80069df2cf7385486caabc50ccde8349d35d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 21 Feb 2021 20:51:44 +0300 Subject: Dbx_sqlite: Backup should return error if backup failed --- plugins/Dbx_sqlite/src/dbintf.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/plugins/Dbx_sqlite/src/dbintf.cpp b/plugins/Dbx_sqlite/src/dbintf.cpp index 7523153359..f58f9888d1 100755 --- a/plugins/Dbx_sqlite/src/dbintf.cpp +++ b/plugins/Dbx_sqlite/src/dbintf.cpp @@ -155,17 +155,19 @@ BOOL CDbxSQLite::Backup(LPCWSTR profile) int rc = sqlite3_open_v2(path, &database, SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE | SQLITE_OPEN_EXCLUSIVE, nullptr); if (rc != SQLITE_OK) { logError(rc, __FILE__, __LINE__); - return FALSE; + return rc; } mir_cslock lock(m_csDbAccess); sqlite3_backup *backup = sqlite3_backup_init(database, "main", m_db, "main"); - if (backup) { - sqlite3_backup_step(backup, -1); - sqlite3_backup_finish(backup); + if (backup == nullptr) { + sqlite3_close(database); + return ERROR_BACKUP_CONTROLLER; } - + + sqlite3_backup_step(backup, -1); + sqlite3_backup_finish(backup); sqlite3_close(database); return 0; } -- cgit v1.2.3