aboutsummaryrefslogtreecommitdiff
path: root/ext/wasm/api/sqlite3-api-opfs.js
diff options
context:
space:
mode:
authorstephan <stephan@noemail.net>2022-09-19 09:25:25 +0000
committerstephan <stephan@noemail.net>2022-09-19 09:25:25 +0000
commit862281fc47187e37b10c1fbd46250de23ebef452 (patch)
tree2ba8c84bcb9f2e21299861ff7313eb2124efd384 /ext/wasm/api/sqlite3-api-opfs.js
parent8766fd20d147c224f4bb6029699bb412bf636182 (diff)
downloadsqlite-862281fc47187e37b10c1fbd46250de23ebef452.tar.gz
sqlite-862281fc47187e37b10c1fbd46250de23ebef452.zip
Correct OPFS VFS xRead() to copy the result buffer if the result code is SQLITE_IOERR_SHORT_READ.
FossilOrigin-Name: 56668f9902c6e896b6c63621a444444c6f58ee20f88a5feae97f1699be35892d
Diffstat (limited to 'ext/wasm/api/sqlite3-api-opfs.js')
-rw-r--r--ext/wasm/api/sqlite3-api-opfs.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/ext/wasm/api/sqlite3-api-opfs.js b/ext/wasm/api/sqlite3-api-opfs.js
index d6a9dbd22..6446f2fb3 100644
--- a/ext/wasm/api/sqlite3-api-opfs.js
+++ b/ext/wasm/api/sqlite3-api-opfs.js
@@ -386,9 +386,10 @@ sqlite3.installOpfsVfs = function callee(asyncProxyUri = callee.defaultProxyUri)
try {
// FIXME(?): block until we finish copying the xRead result buffer. How?
rc = opRun('xRead',{fid:pFile, n, offset});
- if(0!==rc) return rc;
- let i = 0;
- for(; i < n; ++i) wasm.setMemValue(pDest + i, f.sabView[i]);
+ if(0===rc || capi.SQLITE_IOERR_SHORT_READ===rc){
+ let i = 0;
+ for(; i < n; ++i) wasm.setMemValue(pDest + i, f.sabView[i]);
+ }
}catch(e){
error("xRead(",arguments,") failed:",e,f);
rc = capi.SQLITE_IOERR_READ;