diff options
author | drh <drh@noemail.net> | 2010-07-15 18:38:39 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2010-07-15 18:38:39 +0000 |
commit | 8ab58665bc80bd745422d71a114d6a88b8181b76 (patch) | |
tree | 0da8dcf4795de757488ffc929f0e3d9a10d849fb /src/os_unix.c | |
parent | a4ced195db99a0f0effb615e3322badc3bb48f5e (diff) | |
download | sqlite-8ab58665bc80bd745422d71a114d6a88b8181b76.tar.gz sqlite-8ab58665bc80bd745422d71a114d6a88b8181b76.zip |
Previous check-in [534aab837e] accidently reverted some
changes from [a121cd80c5]. This check-in restores those changes.
FossilOrigin-Name: abff795f38e33d778c8dd494a601bc029237da9e
Diffstat (limited to 'src/os_unix.c')
-rw-r--r-- | src/os_unix.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/os_unix.c b/src/os_unix.c index 0413c5dfa..43487404b 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -4330,13 +4330,14 @@ static UnixUnusedFd *findReusableFd(const char *zPath, int flags){ ** ** If the file being opened is a temporary file, it is always created with ** the octal permissions 0600 (read/writable by owner only). If the file -** is a database, journal or master journal file, it is created with the -** permissions mask SQLITE_DEFAULT_FILE_PERMISSIONS. +** is a database or master journal file, it is created with the permissions +** mask SQLITE_DEFAULT_FILE_PERMISSIONS. ** -** Finally, if the file being opened is a WAL file, then this function -** queries the file-system for the permissions on the corresponding database -** file and sets *pMode to this value. Whenever possible, WAL files are -** created using the same permissions as the associated database file. +** Finally, if the file being opened is a WAL or regular journal file, then +** this function queries the file-system for the permissions on the +** corresponding database file and sets *pMode to this value. Whenever +** possible, WAL and journal files are created using the same permissions +** as the associated database file. */ static int findCreateFileMode( const char *zPath, /* Path of file (possibly) being created */ @@ -4344,12 +4345,12 @@ static int findCreateFileMode( mode_t *pMode /* OUT: Permissions to open file with */ ){ int rc = SQLITE_OK; /* Return Code */ - if( flags & SQLITE_OPEN_WAL ){ + if( flags & (SQLITE_OPEN_WAL|SQLITE_OPEN_MAIN_JOURNAL) ){ char zDb[MAX_PATHNAME+1]; /* Database file path */ int nDb; /* Number of valid bytes in zDb */ struct stat sStat; /* Output of stat() on database file */ - nDb = sqlite3Strlen30(zPath) - 4; + nDb = sqlite3Strlen30(zPath) - ((flags & SQLITE_OPEN_WAL) ? 4 : 8); memcpy(zDb, zPath, nDb); zDb[nDb] = '\0'; if( 0==stat(zDb, &sStat) ){ @@ -4492,6 +4493,7 @@ static int unixOpen( rc = findCreateFileMode(zName, flags, &openMode); if( rc!=SQLITE_OK ){ assert( !p->pUnused ); + assert( eType==SQLITE_OPEN_WAL || eType==SQLITE_OPEN_MAIN_JOURNAL ); return rc; } fd = open(zName, openFlags, openMode); |