about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--database.h1
-rw-r--r--litterbox.c1
-rw-r--r--scoop.c2
3 files changed, 2 insertions, 2 deletions
diff --git a/database.h b/database.h
index 4de1625..97872c9 100644
--- a/database.h
+++ b/database.h
@@ -152,7 +152,6 @@ static inline void dbClose(void) {
 		free(persist);
 		persist = prev;
 	}
-	dbExec(SQL(PRAGMA optimize;));
 	sqlite3_close(db);
 }
 
diff --git a/litterbox.c b/litterbox.c
index 24d5733..ccc3ecd 100644
--- a/litterbox.c
+++ b/litterbox.c
@@ -752,6 +752,7 @@ static void handle(struct Message *msg) {
 }
 
 static void atExit(void) {
+	dbExec(SQL(PRAGMA optimize;));
 	dbClose();
 	if (client) tls_close(client);
 }
diff --git a/scoop.c b/scoop.c
index 031e4e2..e3c3d24 100644
--- a/scoop.c
+++ b/scoop.c
@@ -529,7 +529,7 @@ int main(int argc, char *argv[]) {
 		binds[n++] = Bind(":limit", limit, 0);
 	}
 
-	dbFind(path, SQLITE_OPEN_READWRITE);
+	dbFind(path, SQLITE_OPEN_READONLY);
 	if (dbVersion() != DatabaseVersion) {
 		errx(EX_CONFIG, "database out of date; migrate with litterbox -m");
 	}