1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-10-25 20:58:26 +03:00

Closing a file from the wrong thread is harmless on most systems.

(See ticket #1611)
But on systems like RedHat9 with broken fcntl() locks, it leaks file
descriptors.  That is better than the alternative of prematurely breaking
locks and causing database corruption.  Nevertheless, it would be good
if we could figure out a way to report errors when closing a file from
the wrong thread. (CVS 2946)

FossilOrigin-Name: ad8f12cad1fcd9c54478abe20050f9a953035506
This commit is contained in:
drh
2006-01-15 02:43:16 +00:00
parent 64b1bea3ba
commit 3832230e25
3 changed files with 10 additions and 10 deletions

View File

@@ -1465,12 +1465,12 @@ static int unixClose(OsFile **pId){
int rc;
if( !id ) return SQLITE_OK;
rc = unixUnlock(*pId, NO_LOCK);
unixUnlock(*pId, NO_LOCK);
if( id->dirfd>=0 ) close(id->dirfd);
id->dirfd = -1;
sqlite3OsEnterMutex();
if( id->pOpen->nLock && rc==SQLITE_OK ){
if( id->pOpen->nLock ){
/* If there are outstanding locks, do not actually close the file just
** yet because that would clear those locks. Instead, add the file
** descriptor to pOpen->aPending. It will be automatically closed when
@@ -1499,7 +1499,7 @@ static int unixClose(OsFile **pId){
OpenCounter(-1);
sqliteFree(id);
*pId = 0;
return SQLITE_OK;
return rc;
}
/*