diff options
author | drh <drh@noemail.net> | 2012-12-06 19:01:42 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2012-12-06 19:01:42 +0000 |
commit | 696b33e622f4f139be012f12671f860c17d0bb67 (patch) | |
tree | 73649ece8e17b06ce5ebc8a1f8e89ef87c602d45 /src/os_unix.c | |
parent | 48dd9deffe0a56081af7055013050b07186b8278 (diff) | |
download | sqlite-696b33e622f4f139be012f12671f860c17d0bb67.tar.gz sqlite-696b33e622f4f139be012f12671f860c17d0bb67.zip |
Add the SQLITE_FCNTL_TEMPFILENAME file control that asks the underlying VFS
to return a new temporary filename. Per request from NSS team at Mozilla.
FossilOrigin-Name: 1a63b1d5fa5d79f96eddbda6d94bc10248863710
Diffstat (limited to 'src/os_unix.c')
-rw-r--r-- | src/os_unix.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/os_unix.c b/src/os_unix.c index a3a012126..315f15018 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -3581,6 +3581,9 @@ static void unixModeBit(unixFile *pFile, unsigned char mask, int *pArg){ } } +/* Forward declaration */ +static int unixGetTempname(int nBuf, char *zBuf); + /* ** Information and control of an open file handle. */ @@ -3618,6 +3621,14 @@ static int unixFileControl(sqlite3_file *id, int op, void *pArg){ *(char**)pArg = sqlite3_mprintf("%s", pFile->pVfs->zName); return SQLITE_OK; } + case SQLITE_FCNTL_TEMPFILENAME: { + char *zTFile = sqlite3_malloc( pFile->pVfs->mxPathname ); + if( zTFile ){ + unixGetTempname(pFile->pVfs->mxPathname, zTFile); + *(char**)pArg = zTFile; + } + return SQLITE_OK; + } #ifdef SQLITE_DEBUG /* The pager calls this method to signal that it has done ** a rollback and that the database is therefore unchanged and |