mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-12 13:01:09 +03:00
Allow the unlink() system call to be overridden in os_unix.c.
FossilOrigin-Name: 8d1b5c3ac027ac00d57a250aad45230a09645617
This commit is contained in:
@@ -394,6 +394,9 @@ static struct unix_syscall {
|
||||
#endif
|
||||
#define osFallocate ((int(*)(int,off_t,off_t))aSyscall[15].pCurrent)
|
||||
|
||||
{ "unlink", (sqlite3_syscall_ptr)unlink, 0 },
|
||||
#define osUnlink ((int(*)(const char*))aSyscall[16].pCurrent)
|
||||
|
||||
}; /* End of the overrideable system calls */
|
||||
|
||||
/*
|
||||
@@ -1761,7 +1764,7 @@ static int closeUnixFile(sqlite3_file *id){
|
||||
#if OS_VXWORKS
|
||||
if( pFile->pId ){
|
||||
if( pFile->isDelete ){
|
||||
unlink(pFile->pId->zCanonicalName);
|
||||
osUnlink(pFile->pId->zCanonicalName);
|
||||
}
|
||||
vxworksReleaseFileId(pFile->pId);
|
||||
pFile->pId = 0;
|
||||
@@ -2010,7 +2013,7 @@ static int dotlockUnlock(sqlite3_file *id, int eFileLock) {
|
||||
|
||||
/* To fully unlock the database, delete the lock file */
|
||||
assert( eFileLock==NO_LOCK );
|
||||
if( unlink(zLockFile) ){
|
||||
if( osUnlink(zLockFile) ){
|
||||
int rc = 0;
|
||||
int tErrno = errno;
|
||||
if( ENOENT != tErrno ){
|
||||
@@ -4162,7 +4165,7 @@ static int unixShmUnmap(
|
||||
assert( pShmNode->nRef>0 );
|
||||
pShmNode->nRef--;
|
||||
if( pShmNode->nRef==0 ){
|
||||
if( deleteFlag && pShmNode->h>=0 ) unlink(pShmNode->zFilename);
|
||||
if( deleteFlag && pShmNode->h>=0 ) osUnlink(pShmNode->zFilename);
|
||||
unixShmPurge(pDbFd);
|
||||
}
|
||||
unixLeaveMutex();
|
||||
@@ -4642,7 +4645,7 @@ static int fillInUnixFile(
|
||||
if( rc!=SQLITE_OK ){
|
||||
if( h>=0 ) robust_close(pNew, h, __LINE__);
|
||||
h = -1;
|
||||
unlink(zFilename);
|
||||
osUnlink(zFilename);
|
||||
isDelete = 0;
|
||||
}
|
||||
pNew->isDelete = isDelete;
|
||||
@@ -5049,7 +5052,7 @@ static int unixOpen(
|
||||
#if OS_VXWORKS
|
||||
zPath = zName;
|
||||
#else
|
||||
unlink(zName);
|
||||
osUnlink(zName);
|
||||
#endif
|
||||
}
|
||||
#if SQLITE_ENABLE_LOCKING_STYLE
|
||||
@@ -5164,7 +5167,7 @@ static int unixDelete(
|
||||
int rc = SQLITE_OK;
|
||||
UNUSED_PARAMETER(NotUsed);
|
||||
SimulateIOError(return SQLITE_IOERR_DELETE);
|
||||
if( unlink(zPath)==(-1) && errno!=ENOENT ){
|
||||
if( osUnlink(zPath)==(-1) && errno!=ENOENT ){
|
||||
return unixLogError(SQLITE_IOERR_DELETE, "unlink", zPath);
|
||||
}
|
||||
#ifndef SQLITE_DISABLE_DIRSYNC
|
||||
@@ -5921,7 +5924,7 @@ static int proxyBreakConchLock(unixFile *pFile, uuid_t myHostID){
|
||||
end_breaklock:
|
||||
if( rc ){
|
||||
if( fd>=0 ){
|
||||
unlink(tPath);
|
||||
osUnlink(tPath);
|
||||
robust_close(pFile, fd, __LINE__);
|
||||
}
|
||||
fprintf(stderr, "failed to break stale lock on %s, %s\n", cPath, errmsg);
|
||||
@@ -6744,7 +6747,7 @@ int sqlite3_os_init(void){
|
||||
|
||||
/* Double-check that the aSyscall[] array has been constructed
|
||||
** correctly. See ticket [bb3a86e890c8e96ab] */
|
||||
assert( ArraySize(aSyscall)==16 );
|
||||
assert( ArraySize(aSyscall)==17 );
|
||||
|
||||
/* Register all VFSes defined in the aVfs[] array */
|
||||
for(i=0; i<(sizeof(aVfs)/sizeof(sqlite3_vfs)); i++){
|
||||
|
||||
Reference in New Issue
Block a user