mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-12 13:01:09 +03:00
Add the SQLITE_UNLINK_AFTER_CLOSE compile-time option. If enabled, the
unlink of temporary files on unix is deferred until after the file is closed. FossilOrigin-Name: e43a2f92b616ec885a1ee62911fa8f6991d277f7
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user