From: stephan Date: Fri, 16 Sep 2022 01:08:06 +0000 (+0000) Subject: Pull the src/os_kv.c part of [13839759f8f4] into the kv-vfs branch. X-Git-Tag: version-3.40.0~169^2~111^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d22cfa8c80e9d95ed4068083f7dd5ffbb8f29dda;p=thirdparty%2Fsqlite.git Pull the src/os_kv.c part of [13839759f8f4] into the kv-vfs branch. FossilOrigin-Name: e334449912d5176e355d02024a07ed867741f71c9d10ce6744ca800414bf3eeb --- diff --git a/manifest b/manifest index e8ffc8d53e..da3fab544e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\san\sextraneous\skey-copy\sop\sin\sthe\sEM_JS\simpl\sof\skvstorageDelete(). -D 2022-09-12T20:21:34.667 +C Pull\sthe\ssrc/os_kv.c\spart\sof\s[13839759f8f4]\sinto\sthe\skv-vfs\sbranch. +D 2022-09-16T01:08:06.279 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -574,7 +574,7 @@ F src/notify.c 89a97dc854c3aa62ad5f384ef50c5a4a11d70fcc69f86de3e991573421130ed6 F src/os.c 0eb831ba3575af5277e47f4edd14fdfc90025c67eb25ce5cda634518d308d4e9 F src/os.h 1ff5ae51d339d0e30d8a9d814f4b8f8e448169304d83a7ed9db66a65732f3e63 F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85 -F src/os_kv.c 889c6f9b59702859f9041549845769bae2cbd6b59cf15bd7904551a676b85533 +F src/os_kv.c d4909b439043183f9b6aec65528a7433cee49d41cca95b9a3a4c8fb6bbedc0c2 F src/os_setup.h 0711dbc4678f3ac52d7fe736951b6384a0615387c4ba5135a4764e4e31f4b6a6 F src/os_unix.c 0fa91925f0b8831fc0156a9c04d39d86f85baf9eef66c98712395e1715cb75cc F src/os_win.c e9454cb141908e8eef2102180bad353a36480612d5b736e4c2bd5777d9b25a34 @@ -2004,8 +2004,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 878cc93e779c3857adc711f212520f007256274fcd3f6f3d72c754a937fcd198 -R ea387427fef090c92e0fdcd9a6ab25a2 +P 1c5aeee45564c14e7e2e7730f3f52106339ea3148fb5aa786fa767a35db46f51 +R 06fb792046d4c535864a12af9a1a5d61 U stephan -Z d8eaf9989333b333239c3719fa4ba2d7 +Z 125d6637967f22bfb5b9fb3681eda03b # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 8dbaf37dda..445b7e7e25 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1c5aeee45564c14e7e2e7730f3f52106339ea3148fb5aa786fa767a35db46f51 \ No newline at end of file +e334449912d5176e355d02024a07ed867741f71c9d10ce6744ca800414bf3eeb \ No newline at end of file diff --git a/src/os_kv.c b/src/os_kv.c index 62214a13ad..17d4c254e1 100644 --- a/src/os_kv.c +++ b/src/os_kv.c @@ -351,7 +351,7 @@ int sqlite3__wasm_emjs_kvvfs(int whichOp){ switch( whichOp ){ case 0: break; case 1: - kvstorageWrite(zClass, zKey, "world"); + rc = kvstorageWrite(zClass, zKey, "world"); break; case 2: { char buffer[128] = {0}; @@ -602,7 +602,7 @@ static void kvvfsDecodeJournal( const char *zTxt, /* Text encoding. Zero-terminated */ int nTxt /* Bytes in zTxt, excluding zero terminator */ ){ - unsigned int n = 0; + unsigned int n; int c, i, mult; i = 0; mult = 1; @@ -634,10 +634,10 @@ static sqlite3_int64 kvvfsReadFileSize(KVVfsFile *pFile){ kvstorageRead(pFile->zClass, "sz", zData, sizeof(zData)-1); return strtoll(zData, 0, 0); } -static void kvvfsWriteFileSize(KVVfsFile *pFile, sqlite3_int64 sz){ +static int kvvfsWriteFileSize(KVVfsFile *pFile, sqlite3_int64 sz){ char zData[50]; sqlite3_snprintf(sizeof(zData), zData, "%lld", sz); - kvstorageWrite(pFile->zClass, "sz", zData); + return kvstorageWrite(pFile->zClass, "sz", zData); } /****** sqlite3_io_methods methods ******************************************/ @@ -788,7 +788,9 @@ static int kvvfsWriteDb( pgno = 1 + iOfst/iAmt; sqlite3_snprintf(sizeof(zKey), zKey, "%u", pgno); kvvfsEncode(zBuf, iAmt, aData); - kvstorageWrite(pFile->zClass, zKey, aData); + if( kvstorageWrite(pFile->zClass, zKey, aData) ){ + return SQLITE_IOERR; + } if( iOfst+iAmt > pFile->szDb ){ pFile->szDb = iOfst + iAmt; } @@ -825,8 +827,7 @@ static int kvvfsTruncateDb(sqlite3_file *pProtoFile, sqlite_int64 size){ pgno++; } pFile->szDb = size; - kvvfsWriteFileSize(pFile, size); - return SQLITE_OK; + return kvvfsWriteFileSize(pFile, size) ? SQLITE_IOERR : SQLITE_OK; } return SQLITE_IOERR; } @@ -854,17 +855,18 @@ static int kvvfsSyncJrnl(sqlite3_file *pProtoFile, int flags){ }while( n>0 ); zOut[i++] = ' '; kvvfsEncode(pFile->aJrnl, pFile->nJrnl, &zOut[i]); - kvstorageWrite(pFile->zClass, "jrnl", zOut); + i = kvstorageWrite(pFile->zClass, "jrnl", zOut); sqlite3_free(zOut); - return SQLITE_OK; + return i ? SQLITE_IOERR : SQLITE_OK; } static int kvvfsSyncDb(sqlite3_file *pProtoFile, int flags){ KVVfsFile *pFile = (KVVfsFile *)pProtoFile; + int rc = SQLITE_OK; SQLITE_KV_LOG(("xSync('%s-db')\n", pFile->zClass)); - if( pFile->szDb>0 ){ - kvvfsWriteFileSize(pFile, pFile->szDb); + if( pFile->szDb>0 && 0!=kvvfsWriteFileSize(pFile, pFile->szDb) ){ + rc = SQLITE_IOERR; } - return SQLITE_OK; + return rc; } /*