29 lines
998 B
Diff
29 lines
998 B
Diff
From 8c3347d43170dfddc88255e31e28c4d7e506d2fc Mon Sep 17 00:00:00 2001
|
|
From: baizg1107 <preloyalwhite@163.com>
|
|
Date: Tue, 9 Feb 2021 19:41:21 +0800
|
|
Subject: [PATCH] work around btrfs sqlite
|
|
|
|
---
|
|
nss/lib/softoken/sdb.c | 5 +++++
|
|
1 file changed, 5 insertions(+)
|
|
|
|
diff --git a/nss/lib/softoken/sdb.c b/nss/lib/softoken/sdb.c
|
|
index de0fd1f..b2fc0d1 100644
|
|
--- a/nss/lib/softoken/sdb.c
|
|
+++ b/nss/lib/softoken/sdb.c
|
|
@@ -690,6 +690,11 @@ sdb_openDB(const char *name, sqlite3 **sqlDB, int flags)
|
|
openFlags = SQLITE_OPEN_READONLY;
|
|
} else {
|
|
openFlags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE;
|
|
+ /* btrfs and sqlite seem to incorrectly open readwrite.
|
|
+ * when the file is readonly explicitly reject that issue here */
|
|
+ if ((_NSSUTIL_Access(name, PR_ACCESS_EXISTS) == PR_SUCCESS) && (_NSSUTIL_Access(name, PR_ACCESS_WRITE_OK) != PR_SUCCESS)) {
|
|
+ return SQLITE_READONLY;
|
|
+ }
|
|
}
|
|
|
|
/* Requires SQLite 3.5.0 or newer. */
|
|
--
|
|
2.23.0
|
|
|