aboutsummaryrefslogtreecommitdiff
path: root/src/test_async.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2009-03-25 14:24:41 +0000
committerdrh <drh@noemail.net>2009-03-25 14:24:41 +0000
commit072db2fb13bc24d55369016e2d4617e3f4a56e84 (patch)
treea412db7c676ac88fc90a3b08c48816b32e0de9e3 /src/test_async.c
parent892404323f0ca6ae3fb8d8b5ba01cb2429069f1c (diff)
downloadsqlite-072db2fb13bc24d55369016e2d4617e3f4a56e84.tar.gz
sqlite-072db2fb13bc24d55369016e2d4617e3f4a56e84.zip
When a VFS.xOpen fails, make sure the pMethods pointer is zeroed on the
sqlite3_file object so that subsequent xClose() operations against that same file handler are no-ops. Bug in the test_async.c module only - not in the core library. Ticket #3744. (CVS 6384) FossilOrigin-Name: c32b454118f4b0cc615edb9b35f749db45f6b36d
Diffstat (limited to 'src/test_async.c')
-rw-r--r--src/test_async.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/test_async.c b/src/test_async.c
index 729085072..689fb5a26 100644
--- a/src/test_async.c
+++ b/src/test_async.c
@@ -10,7 +10,7 @@
**
*************************************************************************
**
-** $Id: test_async.c,v 1.50 2009/03/24 16:27:09 drh Exp $
+** $Id: test_async.c,v 1.51 2009/03/25 14:24:42 drh Exp $
**
** This file contains an example implementation of an asynchronous IO
** backend for SQLite.
@@ -419,7 +419,7 @@ struct AsyncFileData {
sqlite3_file *pBaseWrite; /* Write handle to the underlying Os file */
AsyncFileLock lock; /* Lock state for this handle */
AsyncLock *pLock; /* AsyncLock object for this file system entry */
- AsyncWrite close;
+ AsyncWrite closeOp; /* Preallocated close operation */
};
/*
@@ -701,7 +701,7 @@ static int asyncClose(sqlite3_file *pFile){
p->lock.eLock = 0;
pthread_mutex_unlock(&async.lockMutex);
- addAsyncWrite(&p->close);
+ addAsyncWrite(&p->closeOp);
return SQLITE_OK;
}
@@ -1097,8 +1097,8 @@ static int asyncOpen(
pData->pBaseRead = (sqlite3_file*)z;
z += pVfs->szOsFile;
pData->pBaseWrite = (sqlite3_file*)z;
- pData->close.pFileData = pData;
- pData->close.op = ASYNC_CLOSE;
+ pData->closeOp.pFileData = pData;
+ pData->closeOp.op = ASYNC_CLOSE;
if( zName ){
z += pVfs->szOsFile;
@@ -1186,6 +1186,9 @@ static int asyncOpen(
sqlite3_free(pData);
}
}
+ if( rc!=SQLITE_OK ){
+ p->pMethod = 0;
+ }
return rc;
}