aboutsummaryrefslogtreecommitdiff
path: root/ext/wasm/api
diff options
context:
space:
mode:
authorstephan <stephan@noemail.net>2024-10-17 12:14:34 +0000
committerstephan <stephan@noemail.net>2024-10-17 12:14:34 +0000
commitcab9574668c9d5d8d6da8763860cd95f8d2a787e (patch)
tree6b15c177e55c4931d22c5bb0d2a6efb09efb2e31 /ext/wasm/api
parent6031de92c6e06e014323cab81e4c0ac77123fa27 (diff)
downloadsqlite-cab9574668c9d5d8d6da8763860cd95f8d2a787e.tar.gz
sqlite-cab9574668c9d5d8d6da8763860cd95f8d2a787e.zip
Ensure that the OPFS VFS's xOpen() writes back the read-only flag to the output flags. Resolves the problem reported in [forum:cf37d5ff1182c31081 | forum post cf37d5ff1182c31081].
FossilOrigin-Name: 0a32624015f16fd881a4ecbb56b7833391028d327a95f4c899eee864ed7fe00d
Diffstat (limited to 'ext/wasm/api')
-rw-r--r--ext/wasm/api/sqlite3-opfs-async-proxy.js3
-rw-r--r--ext/wasm/api/sqlite3-vfs-opfs.c-pp.js2
2 files changed, 3 insertions, 2 deletions
diff --git a/ext/wasm/api/sqlite3-opfs-async-proxy.js b/ext/wasm/api/sqlite3-opfs-async-proxy.js
index ca5583971..0028c1025 100644
--- a/ext/wasm/api/sqlite3-opfs-async-proxy.js
+++ b/ext/wasm/api/sqlite3-opfs-async-proxy.js
@@ -506,8 +506,7 @@ const installAsyncProxy = function(){
dirHandle: hDir,
fileHandle: hFile,
sabView: state.sabFileBufView,
- readOnly: create
- ? false : (state.sq3Codes.SQLITE_OPEN_READONLY & flags),
+ readOnly: !create && !!(state.sq3Codes.SQLITE_OPEN_READONLY & flags),
deleteOnClose: !!(state.sq3Codes.SQLITE_OPEN_DELETEONCLOSE & flags)
});
fh.releaseImplicitLocks =
diff --git a/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js b/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js
index 2d11b3583..27f1bfae7 100644
--- a/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js
+++ b/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js
@@ -922,6 +922,8 @@ const installOpfsVfs = function callee(options){
fh.filename = zName;
fh.sab = new SharedArrayBuffer(state.fileBufferSize);
fh.flags = flags;
+ fh.readOnly = !(sqlite3.SQLITE_OPEN_CREATE & flags)
+ && !!(flags & capi.SQLITE_OPEN_READONLY);
const rc = opRun('xOpen', pFile, zName, flags, opfsFlags);
if(!rc){
/* Recall that sqlite3_vfs::xClose() will be called, even on