- C Refactor\ssqlite3OsFileControlNoFail()\sinto\ssqlite3FileControlHint().
- D 2012-01-10T17:59:59.268
-C Add\sfunction\ssqlite3OsFileControlNoFail(),\swhich\sis\sthe\ssame\sas\ssqlite3OsFileControl()\sexcept\sthat\sit\sdoes\snot\ssimulate\sOOM\serrors.\sThis\ssaves\sadding\scalls\sto\sthe\sBenignMalloc()\sfunctions\saround\seach\sof\sthe\sinvocations\sof\ssqliteOsFileControl()\sthat\signore\sthe\sreturn\scode.
-D 2012-01-10T16:56:39.621
++C Only\srequire\sdouble-zero\sterminators\son\sdatabase\sfilenames,\snot\sany\severy\nfiles\ssupplied\sto\sthe\sxOpen\smethod.\s\sThis\sbacks\sout\s[2544f233f1].\s\sAlso\nrefactor\sthe\sfillInUnixFile()\sroutine\sin\sos_unix.c\sto\sreduce\sthe\snumber\nof\sparameters.
++D 2012-01-10T23:18:38.025
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 5b4a3e12a850b021547e43daf886b25133b44c07
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F src/mutex_unix.c c3a4e00f96ba068a8dbef34084465979aaf369cc
F src/mutex_w32.c 5e54f3ba275bcb5d00248b8c23107df2e2f73e33
F src/notify.c 976dd0f6171d4588e89e874fcc765e92914b6d30
-F src/os.c dedfe4786cc4a88033bbf43fcf1fb01cbec03dcc
-F src/os.h 7a24446bcd9834d868b2bc303ec3bd38e64e04bc
+F src/os.c e1acdc09ff3ac2412945cca9766e2dcf4675f31c
+F src/os.h a2219c3b05ce31230bb000fdc4f1a542b33ee649
F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440
--F src/os_unix.c 2ad4366b3c41dc813345d6dbb3cab97d62d60b96
++F src/os_unix.c 657672fab2580a84116c140b36ee3d6b6fc75b4e
F src/os_win.c e344ccb73aaeb5caab2c3419fba2857f914198d7
- F src/pager.c 355f00af21d490a88e2e2e6aec26237a621de1be
-F src/pager.c e7c940ef4a3bad34c9c44ac429257fcf301b828f
++F src/pager.c 99ee9e52e48bd42bd7523968017c057b93d75df9
F src/pager.h 5cd760857707529b403837d813d86b68938d6183
F src/parse.y fabb2e7047417d840e6fdb3ef0988a86849a08ba
F src/pcache.c f8043b433a57aba85384a531e3937a804432a346
F src/tclsqlite.c bd86070f52ae3f77a2e6b3b065ff03adb9140bfa
F src/test1.c 1b1e514e85ffe7152b02cba38bd0a1ce8cd56113
F src/test2.c 80d323d11e909cf0eb1b6fbb4ac22276483bcf31
--F src/test3.c 124ff9735fb6bb7d41de180d6bac90e7b1509432
++F src/test3.c 91d3f1a09cfae3533ef17d8b484a160f3d1f1a21
F src/test4.c d1e5a5e904d4b444cf572391fdcb017638e36ff7
F src/test5.c e1a19845625144caf038031234a12185e40d315c
F src/test6.c cf6ab27a59e1ab64b011bb251ba600131e803e59
F src/test_journal.c 2c06e4be6584d51b935dc8b353980a9388de62ef
F src/test_loadext.c df586c27176e3c2cb2e099c78da67bf14379a56e
F src/test_malloc.c 8d416f29ad8573f32601f6056c9d2b17472e9ad5
--F src/test_multiplex.c 6415713a7f36caa91d27fc9a53afbee235e65ab6
++F src/test_multiplex.c 67c210e2cdd63c4962c5cb20bd8fd2fd4d7a8410
F src/test_multiplex.h e99c571bc4968b7a9363b661481f3934bfead61d
F src/test_mutex.c a6bd7b9cf6e19d989e31392b06ac8d189f0d573e
F src/test_onefile.c 40cf9e212a377a6511469384a64b01e6e34b2eec
F src/trigger.c ee7e178fb9188f44b532cebd449a7c1df90fb684
F src/update.c d3076782c887c10e882996550345da9c4c9f9dea
F src/utf.c 890c67dcfcc7a74623c95baac7535aadfe265e84
--F src/util.c d124c1f192bdcac733908fadd186f943788e7d2b
++F src/util.c 9e07bd67dfafe9c75b1da78c87ba030cebbb5388
F src/vacuum.c 0c0ba2242355c6048d65e2b333abe0f7c06348fa
F src/vdbe.c 64e3fc0bb56c54ceac3cc1d1e65257bfda21550e
F src/vdbe.h 18f581cac1f4339ec3299f3e0cc6e11aec654cdb
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
F tool/warnings-clang.sh 9f406d66e750e8ac031c63a9ef3248aaa347ef2a
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
- P 2544f233f1041a42bbdbb5413d2bc92b2a2e0397
- R 90d4428386a9e255bbb4a91446028664
-P 7f852ac6435f1c9e25b07f816cca5ba40484579e
-R 0386e0f2452004fbea4274e17c048ecf
-U dan
-Z d0553b98b27ed93d2ef4aa9f634cdd90
++P 722735a4f316630c907149f08d3d7dccc0facd9a af59b182d797642e5ec3ddf291cf62662a136bd1
++R 0517e1b31ad3aca42e254a546daa87b4
+U drh
- Z 45ce0d11ceb0dbbfe189c0194c677275
++Z c7868cbe469d9c92bafb5dccf1093985
unsigned fsFlags; /* cached details from statfs() */
#endif
#if OS_VXWORKS
-- int isDelete; /* Delete on close if true */
struct vxworksFileId *pId; /* Unique file ID */
#endif
#ifndef NDEBUG
# define UNIXFILE_DIRSYNC 0x00
#endif
#define UNIXFILE_PSOW 0x10 /* SQLITE_IOCAP_POWERSAFE_OVERWRITE */
++#define UNIXFILE_DELETE 0x20 /* Delete on close */
++#define UNIXFILE_URI 0x40 /* Filename might have query parameters */
++#define UNIXFILE_NOLOCK 0x80 /* Do no file locking */
/*
** Include code that is common to all os_*.c files
}
#if OS_VXWORKS
if( pFile->pId ){
-- if( pFile->isDelete ){
++ if( pFile->ctrlFlags & UNIXFILE_DELETE ){
osUnlink(pFile->pId->zCanonicalName);
}
vxworksReleaseFileId(pFile->pId);
static int fillInUnixFile(
sqlite3_vfs *pVfs, /* Pointer to vfs object */
int h, /* Open file descriptor of file being opened */
-- int syncDir, /* True to sync directory on first sync */
sqlite3_file *pId, /* Write to the unixFile structure here */
const char *zFilename, /* Name of the file being opened */
-- int noLock, /* Omit locking if true */
-- int isDelete, /* Delete on close if true */
-- int isReadOnly /* True if the file is opened read-only */
++ int ctrlFlags /* Zero or more UNIXFILE_* values */
){
const sqlite3_io_methods *pLockingStyle;
unixFile *pNew = (unixFile *)pId;
assert( pNew->pInode==NULL );
-- /* Parameter isDelete is only used on vxworks. Express this explicitly
-- ** here to prevent compiler warnings about unused parameters.
-- */
-- UNUSED_PARAMETER(isDelete);
--
/* Usually the path zFilename should not be a relative pathname. The
** exception is when opening the proxy "conch" file in builds that
** include the special Apple locking styles.
#endif
/* No locking occurs in temporary files */
-- assert( zFilename!=0 || noLock );
++ assert( zFilename!=0 || (ctrlFlags & UNIXFILE_NOLOCK)!=0 );
OSTRACE(("OPEN %-3d %s\n", h, zFilename));
pNew->h = h;
pNew->pVfs = pVfs;
pNew->zPath = zFilename;
-- pNew->ctrlFlags = 0;
-- if( sqlite3_uri_boolean(zFilename, "psow", SQLITE_POWERSAFE_OVERWRITE) ){
++ pNew->ctrlFlags = (u8)ctrlFlags;
++ if( sqlite3_uri_boolean(((ctrlFlags & UNIXFILE_URI) ? zFilename : 0),
++ "psow", SQLITE_POWERSAFE_OVERWRITE) ){
pNew->ctrlFlags |= UNIXFILE_PSOW;
}
if( memcmp(pVfs->zName,"unix-excl",10)==0 ){
pNew->ctrlFlags |= UNIXFILE_EXCL;
}
-- if( isReadOnly ){
-- pNew->ctrlFlags |= UNIXFILE_RDONLY;
-- }
-- if( syncDir ){
-- pNew->ctrlFlags |= UNIXFILE_DIRSYNC;
-- }
#if OS_VXWORKS
pNew->pId = vxworksFindFileId(zFilename);
if( pNew->pId==0 ){
-- noLock = 1;
++ ctrlFlags |= UNIXFILE_NOLOCK;
rc = SQLITE_NOMEM;
}
#endif
-- if( noLock ){
++ if( ctrlFlags & UNIXFILE_NOLOCK ){
pLockingStyle = &nolockIoMethods;
}else{
pLockingStyle = (**(finder_type*)pVfs->pAppData)(zFilename, pNew);
osUnlink(zFilename);
isDelete = 0;
}
-- pNew->isDelete = isDelete;
++ if( isDelete ) pNew->ctrlFlags |= UNIXFILE_DELETE;
#endif
if( rc!=SQLITE_OK ){
if( h>=0 ) robust_close(pNew, h, __LINE__);
/* Check that the output buffer is large enough for the temporary file
** name. If it is not, return SQLITE_ERROR.
*/
-- if( (strlen(zDir) + strlen(SQLITE_TEMP_FILE_PREFIX) + 17) >= (size_t)nBuf ){
++ if( (strlen(zDir) + strlen(SQLITE_TEMP_FILE_PREFIX) + 18) >= (size_t)nBuf ){
return SQLITE_ERROR;
}
do{
-- sqlite3_snprintf(nBuf-17, zBuf, "%s/"SQLITE_TEMP_FILE_PREFIX, zDir);
++ sqlite3_snprintf(nBuf-18, zBuf, "%s/"SQLITE_TEMP_FILE_PREFIX, zDir);
j = (int)strlen(zBuf);
sqlite3_randomness(15, &zBuf[j]);
for(i=0; i<15; i++, j++){
zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ];
}
zBuf[j] = 0;
++ zBuf[j+1] = 0;
}while( osAccess(zBuf,0)==0 );
return SQLITE_OK;
}
int eType = flags&0xFFFFFF00; /* Type of file to open */
int noLock; /* True to omit locking primitives */
int rc = SQLITE_OK; /* Function Return Code */
++ int ctrlFlags = 0; /* UNIXFILE_* flags */
int isExclusive = (flags & SQLITE_OPEN_EXCLUSIVE);
int isDelete = (flags & SQLITE_OPEN_DELETEONCLOSE);
/* If argument zPath is a NULL pointer, this function is required to open
** a temporary file. Use this buffer to store the file name in.
*/
-- char zTmpname[MAX_PATHNAME+1];
++ char zTmpname[MAX_PATHNAME+2];
const char *zName = zPath;
/* Check the following statements are true:
}
}
p->pUnused = pUnused;
++
++ /* Database filenames are double-zero terminated if they are not
++ ** URIs with parameters. Hence, they can always be passed into
++ ** sqlite3_uri_parameter(). */
++ assert( (flags & SQLITE_OPEN_URI) || zName[strlen(zName)+1]==0 );
++
}else if( !zName ){
/* If zName is NULL, the upper layer is requesting a temp file. */
assert(isDelete && !syncDir);
-- rc = unixGetTempname(MAX_PATHNAME+1, zTmpname);
++ rc = unixGetTempname(MAX_PATHNAME+2, zTmpname);
if( rc!=SQLITE_OK ){
return rc;
}
zName = zTmpname;
++
++ /* Generated temporary filenames are always double-zero terminated
++ ** for use by sqlite3_uri_parameter(). */
++ assert( zName[strlen(zName)+1]==0 );
}
/* Determine the value of the flags parameter passed to POSIX function
((unixFile*)pFile)->fsFlags |= SQLITE_FSFLAGS_IS_MSDOS;
}
#endif
--
++
++ /* Set up appropriate ctrlFlags */
++ if( isDelete ) ctrlFlags |= UNIXFILE_DELETE;
++ if( isReadonly ) ctrlFlags |= UNIXFILE_RDONLY;
++ if( noLock ) ctrlFlags |= UNIXFILE_NOLOCK;
++ if( syncDir ) ctrlFlags |= UNIXFILE_DIRSYNC;
++ if( flags & SQLITE_OPEN_URI ) ctrlFlags |= UNIXFILE_URI;
++
#if SQLITE_ENABLE_LOCKING_STYLE
#if SQLITE_PREFER_PROXY_LOCKING
isAutoProxy = 1;
useProxy = !(fsInfo.f_flags&MNT_LOCAL);
}
if( useProxy ){
-- rc = fillInUnixFile(pVfs, fd, syncDir, pFile, zPath, noLock,
-- isDelete, isReadonly);
++ rc = fillInUnixFile(pVfs, fd, pFile, zPath, ctrlFlags);
if( rc==SQLITE_OK ){
rc = proxyTransformUnixFile((unixFile*)pFile, ":auto:");
if( rc!=SQLITE_OK ){
}
#endif
-- rc = fillInUnixFile(pVfs, fd, syncDir, pFile, zPath, noLock,
-- isDelete, isReadonly);
++ rc = fillInUnixFile(pVfs, fd, pFile, zPath, ctrlFlags);
++
open_finished:
if( rc!=SQLITE_OK ){
sqlite3_free(p->pUnused);
pUnused->flags = openFlags;
pNew->pUnused = pUnused;
-- rc = fillInUnixFile(&dummyVfs, fd, 0, (sqlite3_file*)pNew, path, 0, 0, 0);
++ rc = fillInUnixFile(&dummyVfs, fd, (sqlite3_file*)pNew, path, 0);
if( rc==SQLITE_OK ){
*ppFile = pNew;
return SQLITE_OK;