summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2021-02-21 20:51:44 +0300
committerGeorge Hazan <ghazan@miranda.im>2021-02-21 20:51:44 +0300
commit22cb80069df2cf7385486caabc50ccde8349d35d (patch)
tree9acb3e515e424f89c105f11dfe3899d2ee498e6e
parentf51a4dda49c032dc8ab5d073331bcb3c93bd086b (diff)
Dbx_sqlite: Backup should return error if backup failed
-rwxr-xr-xplugins/Dbx_sqlite/src/dbintf.cpp12
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;
}