aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/os.c7
-rw-r--r--src/test_async.c13
2 files changed, 13 insertions, 7 deletions
diff --git a/src/os.c b/src/os.c
index c3533880f..d879b8a4b 100644
--- a/src/os.c
+++ b/src/os.c
@@ -13,7 +13,7 @@
** This file contains OS interface code that is common to all
** architectures.
**
-** $Id: os.c,v 1.125 2008/12/08 18:19:18 drh Exp $
+** $Id: os.c,v 1.126 2009/03/25 14:24:42 drh Exp $
*/
#define _SQLITE_OS_C_ 1
#include "sqliteInt.h"
@@ -112,8 +112,11 @@ int sqlite3OsOpen(
int flags,
int *pFlagsOut
){
+ int rc;
DO_OS_MALLOC_TEST;
- return pVfs->xOpen(pVfs, zPath, pFile, flags, pFlagsOut);
+ rc = pVfs->xOpen(pVfs, zPath, pFile, flags, pFlagsOut);
+ assert( rc==SQLITE_OK || pFile->pMethods==0 );
+ return rc;
}
int sqlite3OsDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){
return pVfs->xDelete(pVfs, zPath, dirSync);
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;
}