diff --git a/src/backend_firefox.c b/src/backend_firefox.c index ac0a23f..d96bc43 100644 --- a/src/backend_firefox.c +++ b/src/backend_firefox.c @@ -2683,7 +2683,7 @@ backend_create ( return -1; } - sqlite3 *db = db_open(conf->store_path, readonly); + sqlite3 *db = db_open(conf->store_path); if (db == NULL) { return -1; } @@ -3150,7 +3150,7 @@ backend_mkfs ( // See also: // - // - - sqlite3 *db = db_open(conf->store_path, false); + sqlite3 *db = db_open(conf->store_path); if (db == NULL) { goto end; } diff --git a/src/db.c b/src/db.c index dd0664e..cc4fb37 100644 --- a/src/db.c +++ b/src/db.c @@ -214,26 +214,18 @@ db_fcntl ( sqlite3 * db_open ( - char const *path, - bool readonly + char const *path ) { sqlite3 *db; - int flags = SQLITE_OPEN_READWRITE; - if (readonly) { - flags = SQLITE_OPEN_READONLY; - } - flags |= SQLITE_OPEN_EXRESCODE; + int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_EXRESCODE; if (SQLITE_OK != sqlite3_open_v2(path, &db, flags, NULL)) { log_printf("sqlite3_open_v2(): %s", sqlite3_errmsg(db)); goto fail; } - if (!readonly) { - if (0 != sqlite3_db_readonly(db, "main")) { - log_puts("cannot open database for read/write"); - goto fail; - } + if (0 != sqlite3_db_readonly(db, "main")) { + log_puts("cannot open database for read/write"); + goto fail; } - return db; fail: diff --git a/src/db.h b/src/db.h index a8d99b1..629a292 100644 --- a/src/db.h +++ b/src/db.h @@ -113,8 +113,7 @@ db_fcntl ( sqlite3 * db_open ( - char const *path, - bool readonly + char const *path ); int