]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add the SQLITE_UNLINK_AFTER_CLOSE compile-time option. If enabled, the
authordrh <drh@noemail.net>
Mon, 16 Jun 2014 18:35:06 +0000 (18:35 +0000)
committerdrh <drh@noemail.net>
Mon, 16 Jun 2014 18:35:06 +0000 (18:35 +0000)
unlink of temporary files on unix is deferred until after the file is closed.

FossilOrigin-Name: e43a2f92b616ec885a1ee62911fa8f6991d277f7

manifest
manifest.uuid
src/os_unix.c

index f1645c156ca989ed85fbcc65586f49e3b3148f71..e698ec3432a80cee161cec1d00cdaedf9e695f59 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\san\sapplication\sID\sfor\sMBTiles\stilesets.
-D 2014-06-16T18:17:21.276
+C Add\sthe\sSQLITE_UNLINK_AFTER_CLOSE\scompile-time\soption.\s\sIf\senabled,\sthe\nunlink\sof\stemporary\sfiles\son\sunix\sis\sdeferred\suntil\safter\sthe\sfile\sis\sclosed.
+D 2014-06-16T18:35:06.993
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in ed5e4aae4799f724699d5509fac2977786414dbb
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -207,7 +207,7 @@ F src/os.c 1b147e4cf7cc39e618115c14a086aed44bc91ace
 F src/os.h 60d419395e32a8029fa380a80a3da2e9030f635e
 F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
 F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa
-F src/os_unix.c ae4b5240af4619d711301d7992396e182585269f
+F src/os_unix.c 9a97268f1ea97ddea17f1c392f7c76197ac4cea9
 F src/os_win.c 8dbf6c11780fe2eb96c1f289e664d0c7b2911d37
 F src/os_win.h 057344a6720b4c8405d9bd98f58cb37a6ee46c25
 F src/pager.c f6bb1fa6cdf2062f2d8aec3e64db302bca519ab8
@@ -1177,7 +1177,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 0617e20a33e08754aea14e60db44e557c13978e3
-R dfffbe0f43f71c007c108ea405a7d777
+P 837f6404230fc642e9084140c4b30cca1be43375
+R ecda5288cdc332685194aeb4a49d9a9a
 U drh
-Z 9d670db05a88e1abc553c0c72f8664c9
+Z 0e0dd722026abbeb65bd76ad2a4f4176
index c4c9f65f48f05505c5bf77577119bd41c8baeb38..3ea2a9a55db413dfe1b5218aafb0388cdb45db38 100644 (file)
@@ -1 +1 @@
-837f6404230fc642e9084140c4b30cca1be43375
\ No newline at end of file
+e43a2f92b616ec885a1ee62911fa8f6991d277f7
\ No newline at end of file
index fc320a4926f26c8565c51e4acd5c8b4d7239cb74..7eb25c85f339291f40f763fb399260fb6356542f 100644 (file)
@@ -1918,6 +1918,13 @@ static int closeUnixFile(sqlite3_file *id){
     vxworksReleaseFileId(pFile->pId);
     pFile->pId = 0;
   }
+#endif
+#ifdef SQLITE_UNLINK_AFTER_CLOSE
+  if( pFile->ctrlFlags & UNIXFILE_DELETE ){
+    osUnlink(pFile->zPath);
+    sqlite3_free(*(char**)&pFile->zPath);
+    pFile->zPath = 0;
+  }
 #endif
   OSTRACE(("CLOSE   %-3d\n", pFile->h));
   OpenCounter(-1);
@@ -5772,6 +5779,12 @@ static int unixOpen(
   if( isDelete ){
 #if OS_VXWORKS
     zPath = zName;
+#elif defined(SQLITE_UNLINK_AFTER_CLOSE)
+    zPath = sqlite3_mprintf("%s", zName);
+    if( zPath==0 ){
+      robust_close(p, fd, __LINE__);
+      return SQLITE_NOMEM;
+    }
 #else
     osUnlink(zName);
 #endif