Blame SOURCES/nss-fedora-btrf-sql-hack.patch

d133c5
diff -up ./lib/softoken/sdb.c.orig ./lib/softoken/sdb.c
d133c5
--- ./lib/softoken/sdb.c.orig   2020-12-11 22:49:26.961726193 -0500
d133c5
+++ ./lib/softoken/sdb.c        2020-12-11 23:01:30.739122494 -0500
d133c5
@@ -690,8 +690,14 @@ sdb_openDB(const char *name, sqlite3 **s
d133c5
         openFlags = SQLITE_OPEN_READONLY;
d133c5
     } else {
d133c5
         openFlags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE;
d133c5
+        /* btrfs and sqlite seem to incorrectly open readwrite.
d133c5
+        * when the file is readonly explicitly reject that issue here */
d133c5
+        if ((_NSSUTIL_Access(name, PR_ACCESS_EXISTS) == PR_SUCCESS)  && (_NSSUTIL_Access(name, PR_ACCESS_WRITE_OK) != PR_SUCCESS)) {
d133c5
+            return SQLITE_READONLY;
d133c5
+        }
d133c5
     }
d133c5
d133c5
+
d133c5
     /* Requires SQLite 3.5.0 or newer. */
d133c5
     sqlerr = sqlite3_open_v2(name, sqlDB, openFlags, NULL);
d133c5
     if (sqlerr != SQLITE_OK) {