Open legacy db in R/W mode 35/258335/1
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Thu, 13 May 2021 12:53:32 +0000 (14:53 +0200)
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Thu, 13 May 2021 13:06:56 +0000 (15:06 +0200)
If due to a failure during previous transaction a rollback journal is
generated, the original legacy database has to be restored to the
original state before it can be dumped. However, it can't be done
unless the database is opened in R/W mode.

Change-Id: Icc455f4e820a5be8b0628e95895680e9cbb14eb6

src/manager/sqlcipher/sqlcipher.c

index 2c749fc..97059a2 100644 (file)
@@ -236143,7 +236143,7 @@ __attribute__((visibility("default"))) char *dumpLegacyDb(const char *dbPath, co
 
 
   sqlite3 *db;
-  int rc = sqlite3_open_v2(dbPath, &db, SQLITE_OPEN_READONLY, 0);
+  int rc = sqlite3_open_v2(dbPath, &db, SQLITE_OPEN_READWRITE, 0);
 
   if (!rc && !(rc = sqlite3_key(db, pass, passSize)) && !(rc = sqlite3_exec(db, "PRAGMA cipher_compatibility=2", 0, 0, 0)))
     rc = sqlite3_db_dump(db, ssout, (void*)&out);