diff options
author | George Hazan <ghazan@miranda.im> | 2021-02-21 20:51:44 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2021-02-21 20:51:44 +0300 |
commit | 22cb80069df2cf7385486caabc50ccde8349d35d (patch) | |
tree | 9acb3e515e424f89c105f11dfe3899d2ee498e6e | |
parent | f51a4dda49c032dc8ab5d073331bcb3c93bd086b (diff) |
Dbx_sqlite: Backup should return error if backup failed
-rwxr-xr-x | plugins/Dbx_sqlite/src/dbintf.cpp | 12 |
1 files 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; } |