summaryrefslogtreecommitdiff
path: root/lang/sql/sqlite/ext/async/sqlite3async.c
diff options
context:
space:
mode:
Diffstat (limited to 'lang/sql/sqlite/ext/async/sqlite3async.c')
-rw-r--r--lang/sql/sqlite/ext/async/sqlite3async.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/lang/sql/sqlite/ext/async/sqlite3async.c b/lang/sql/sqlite/ext/async/sqlite3async.c
index a351eaa9..4ab39cac 100644
--- a/lang/sql/sqlite/ext/async/sqlite3async.c
+++ b/lang/sql/sqlite/ext/async/sqlite3async.c
@@ -944,7 +944,7 @@ static int asyncFileControl(sqlite3_file *id, int op, void *pArg){
return SQLITE_OK;
}
}
- return SQLITE_ERROR;
+ return SQLITE_NOTFOUND;
}
/*
@@ -1044,15 +1044,18 @@ static int asyncOpen(
char *z;
int isAsyncOpen = doAsynchronousOpen(flags);
- /* If zName is NULL, then the upper layer is requesting an anonymous file */
+ /* If zName is NULL, then the upper layer is requesting an anonymous file.
+ ** Otherwise, allocate enough space to make a copy of the file name (along
+ ** with the second nul-terminator byte required by xOpen).
+ */
if( zName ){
- nName = (int)strlen(zName)+1;
+ nName = (int)strlen(zName);
}
nByte = (
sizeof(AsyncFileData) + /* AsyncFileData structure */
2 * pVfs->szOsFile + /* AsyncFileData.pBaseRead and pBaseWrite */
- nName /* AsyncFileData.zName */
+ nName + 2 /* AsyncFileData.zName */
);
z = sqlite3_malloc(nByte);
if( !z ){
@@ -1507,6 +1510,7 @@ static void asyncWriterThread(void){
case ASYNC_DELETE:
ASYNC_TRACE(("DELETE %s\n", p->zBuf));
rc = pVfs->xDelete(pVfs, p->zBuf, (int)p->iOffset);
+ if( rc==SQLITE_IOERR_DELETE_NOENT ) rc = SQLITE_OK;
break;
case ASYNC_OPENEXCLUSIVE: {