From: drh <> Date: Tue, 13 Aug 2024 20:16:11 +0000 (+0000) Subject: Use the xDelete method of the VFS rather than direct interation with the X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2a0842063278f69c5583f44c27de1b772ae21ebe;p=thirdparty%2Fsqlite.git Use the xDelete method of the VFS rather than direct interation with the filesystem. FossilOrigin-Name: 96df5aa656a9dd14a8b7ab27de7ec9b7614be44131edd890f15046ac7df03ff1 --- diff --git a/manifest b/manifest index fe9be1b930..21eac6e500 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Infrastructure\sfor\sa\snew\stest\sprogram\snamed\s"iotester"\sthat\sstrives\sto\sverify\nthe\soperation\sof\sa\sVFS\sobject. -D 2024-08-13T19:30:03.469 +C Use\sthe\sxDelete\smethod\sof\sthe\sVFS\srather\sthan\sdirect\sinteration\swith\sthe\nfilesystem. +D 2024-08-13T20:16:11.312 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -1337,7 +1337,7 @@ F test/ioerr3.test d3cec5e1a11ad6d27527d0d38573fbff14c71bdd F test/ioerr4.test f130fe9e71008577b342b8874d52984bd04ede2c F test/ioerr5.test 5984da7bf74b6540aa356f2ab0c6ae68a6d12039a3d798a9ac6a100abc17d520 F test/ioerr6.test a395a6ab144b26a9e3e21059a1ab6a7149cca65b -F test/iotester.c 4df6dff77a78162808854dd6d3810ed4fe2a8fe4ba5e95a74575548f23480026 +F test/iotester.c 19b67e18ebbb7533345f3d875e931cfdeda1cbb912164924558203dea4cefd0e F test/istrue.test e7f285bb70282625c258e866ce6337d4c762922f5a300e1b50f958aef6e7d9c9 F test/join.test f7abfef3faeaf2800308872e33a57e5b6e4a2b44fb8c6b90c6068412e71a6cf4 F test/join2.test 8561fe82ce434ac96de91544072e578dc2cadddf2d9bc9cd802f866a9b92502e @@ -2205,8 +2205,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 9c10664416274df6f8da53ddd86f6356c9704ad798fd4034d2784ae433c1c056 -R d53719958cd6e7f4f987278bf19c1278 +P b46d86c22bd486789affa9c5e41b8f6ee47bae23eee5efe0640db3d3860e8a7a +R 6f0409e082147714d85cbd8fee9f5c89 U drh -Z 4d2d6900391d50d204c15f38c15fadf7 +Z c0cc32f2d8d4cb762b1755f23b9fe78f # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 6e9d3c7338..0a590b65d2 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b46d86c22bd486789affa9c5e41b8f6ee47bae23eee5efe0640db3d3860e8a7a +96df5aa656a9dd14a8b7ab27de7ec9b7614be44131edd890f15046ac7df03ff1 diff --git a/test/iotester.c b/test/iotester.c index 56bb287aa5..e11d9c214e 100644 --- a/test/iotester.c +++ b/test/iotester.c @@ -22,6 +22,7 @@ #include "sqlite3.h" #include #include +#include /* Number of elements in static array X */ #define COUNT(X) (sizeof(X)/sizeof(X[0])) @@ -175,6 +176,20 @@ sqlite3_int64 iotestQueryInt( return res; } +/* +** Delete a file by name using the xDelete method of the default VFS. +*/ +void iotestDeleteFile(IOTester *p, const char *zFilename){ + sqlite3_vfs *pVfs = sqlite3_vfs_find(0); + int rc; + assert( pVfs!=0 ); + assert( pVfs->xDelete!=0 ); + rc = pVfs->xDelete(pVfs, zFilename, 0); + if( rc!=SQLITE_OK && rc!=SQLITE_IOERR_DELETE_NOENT ){ + iotestError(p, "cannot delete file \"%s\"\n", zFilename); + } +} + /* ** Open a database. Return a pointer to that database connection, ** or if something goes wrong, return a NULL pointer. @@ -211,7 +226,7 @@ void iotestBasic1(IOTester *p){ sqlite3 *db = 0; p->zTestModule = "basic1"; iotestBeginTest(p, 1); - iotestUnlink(p, "basic1.db"); + iotestDeleteFile(p, "basic1.db"); if( p->nFault ) return; iotestBeginTest(p, 2); db = iotestOpen(p, "basic1.db"); @@ -224,7 +239,7 @@ void iotestBasic1(IOTester *p){ basic1_exit: sqlite3_close(db); - iotestUnlink(p, "basic1.db"); + iotestDeleteFile(p, "basic1.db"); } /********************** Out-Of-Band System Interactions ********************** @@ -237,30 +252,6 @@ basic1_exit: ** to work on alternative operating systems. */ #include -#ifdef _WIN32 -# include -#else -# include -# include -#endif - -/* Remove the named file from disk, if it exists. -** -** If the file does not exist, this routine is a no-op. -** If the file does exists but could not be removed, this routine raises -** and error in the IOTester module. -*/ -void iotestUnlink(IOTester *p, const char *zFilename){ - int rc; -#ifdef _WIN32 - rc = remove(zFilename); -#else - rc = unlink(zFilename); -#endif - if( rc!=0 && errno!=ENOENT ){ - iotestError(p, "cannot delete file \"%s\"\n", zFilename); - } -} /* ** Start a new test case. (This is under the "Out-of-band" section because