aboutsummaryrefslogtreecommitdiff
path: root/src/os_unix.c
diff options
context:
space:
mode:
authordanielk1977 <danielk1977@noemail.net>2007-09-17 07:02:56 +0000
committerdanielk1977 <danielk1977@noemail.net>2007-09-17 07:02:56 +0000
commitadfb9b0501e005d10aaec727fa56ed5beff0d7d0 (patch)
tree5ab83d741a99c37bae56a628f154647193bded56 /src/os_unix.c
parent76ee37f9bb393e45eaf724921853668960b34294 (diff)
downloadsqlite-adfb9b0501e005d10aaec727fa56ed5beff0d7d0.tar.gz
sqlite-adfb9b0501e005d10aaec727fa56ed5beff0d7d0.zip
Add a parameter to specify the size of the output buffer passed to xGetTempname() and xFullPathname(). This, and the previous commit, are changes to the public vfs API introduced in 3.5.0. (CVS 4433)
FossilOrigin-Name: 8b29f5fbfc723cdf67cf3410cd01f7c17ea39a4b
Diffstat (limited to 'src/os_unix.c')
-rw-r--r--src/os_unix.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index 30e2cbb26..2732f58e9 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -2474,7 +2474,7 @@ static int unixAccess(sqlite3_vfs *pVfs, const char *zPath, int flags){
** by the calling process and must be big enough to hold at least
** pVfs->mxPathname bytes.
*/
-static int unixGetTempname(sqlite3_vfs *pVfs, char *zBuf){
+static int unixGetTempname(sqlite3_vfs *pVfs, int nBuf, char *zBuf){
static const char *azDirs[] = {
0,
"/var/tmp",
@@ -2507,6 +2507,7 @@ static int unixGetTempname(sqlite3_vfs *pVfs, char *zBuf){
}
do{
assert( pVfs->mxPathname==MAX_PATHNAME );
+ assert( nBuf>=MAX_PATHNAME );
sqlite3_snprintf(MAX_PATHNAME-17, zBuf, "%s/"SQLITE_TEMP_FILE_PREFIX, zDir);
j = strlen(zBuf);
sqlite3Randomness(15, &zBuf[j]);
@@ -2528,7 +2529,12 @@ static int unixGetTempname(sqlite3_vfs *pVfs, char *zBuf){
** (in this case, MAX_PATHNAME bytes). The full-path is written to
** this buffer before returning.
*/
-static int unixFullPathname(sqlite3_vfs *pVfs, const char *zPath, char *zOut){
+static int unixFullPathname(
+ sqlite3_vfs *pVfs, /* Pointer to vfs object */
+ const char *zPath, /* Possibly relative input path */
+ int nOut, /* Size of output buffer in bytes */
+ char *zOut /* Output buffer */
+){
/* It's odd to simulate an io-error here, but really this is just
** using the io-error infrastructure to test that SQLite handles this