From 13f2535a787bd812dbd2bb7bb50fdf3024d7479e Mon Sep 17 00:00:00 2001 From: Jiwoong Im Date: Tue, 29 Nov 2016 23:16:38 +0900 Subject: [PATCH] Use journal mode WAL only in R/W normal db Change-Id: I4e0eb34e73f02b49c52695b81d465ec6ab02024b Signed-off-by: Jiwoong Im --- backend/sqlite.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/backend/sqlite.c b/backend/sqlite.c index 13268ec..2f78e42 100644 --- a/backend/sqlite.c +++ b/backend/sqlite.c @@ -87,14 +87,16 @@ static sqlite3 *open_sqlite3(const char *dbpath, bool readonly) } if (!db_exist) { - r = sqlite3_exec(db, "PRAGMA journal_mode = WAL", - NULL, NULL, NULL); - if (r) { - bxt_err("change journal mode '%s' failed: %s", - dbpath, sqlite3_errmsg(db)); - errno = EIO; - free(nm); - return NULL; + if (strncmp("/etc", dbpath, 4)) { + r = sqlite3_exec(db, "PRAGMA journal_mode = WAL", + NULL, NULL, NULL); + if (r) { + bxt_err("change journal mode '%s' failed: %s", + dbpath, sqlite3_errmsg(db)); + errno = EIO; + free(nm); + return NULL; + } } r = sqlite3_exec(db, QUERY_CREATE_TABLE_BUXTON, -- 2.7.4