diff options
author | drh <drh@noemail.net> | 2011-05-31 17:08:32 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2011-05-31 17:08:32 +0000 |
commit | bdd0f3bc0e2bf20d4151c9eb606e5c633d3234de (patch) | |
tree | 1039b2b66db6422026a80334c52b28ecd54e69d2 /src/os_unix.c | |
parent | a96a399ec95667f268c135e74a16bef517b1fca2 (diff) | |
parent | ed9624187d89a96e591353a7bdee53b292e6f849 (diff) | |
download | sqlite-bdd0f3bc0e2bf20d4151c9eb606e5c633d3234de.tar.gz sqlite-bdd0f3bc0e2bf20d4151c9eb606e5c633d3234de.zip |
Merge the latest trunk changes into the wal-readonly branch.
FossilOrigin-Name: 2c6b5a28e3f6b7cb96b944d0a254f3707885f1ce
Diffstat (limited to 'src/os_unix.c')
-rw-r--r-- | src/os_unix.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/os_unix.c b/src/os_unix.c index d463e5917..947f431ae 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -3775,6 +3775,7 @@ static int unixOpenSharedMemory(unixFile *pDbFd){ (u32)sStat.st_ino, (u32)sStat.st_dev); #else sqlite3_snprintf(nShmFilename, zShmFilename, "%s-shm", pDbFd->zPath); + sqlite3FileSuffix3(pDbFd->zPath, zShmFilename); #endif pShmNode->h = -1; pDbFd->pInode->pShmNode = pShmNode; @@ -4827,6 +4828,11 @@ static UnixUnusedFd *findReusableFd(const char *zPath, int flags){ ** 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. +** +** If the SQLITE_ENABLE_8_3_NAMES option is enabled, then the +** original filename is unavailable. But 8_3_NAMES is only used for +** FAT filesystems and permissions do not matter there, so just use +** the default permissions. */ static int findCreateFileMode( const char *zPath, /* Path of file (possibly) being created */ @@ -4834,6 +4840,7 @@ static int findCreateFileMode( mode_t *pMode /* OUT: Permissions to open file with */ ){ int rc = SQLITE_OK; /* Return Code */ + *pMode = SQLITE_DEFAULT_FILE_PERMISSIONS; 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 */ @@ -4845,15 +4852,15 @@ static int findCreateFileMode( ** ** "<path to db>-journal" ** "<path to db>-wal" - ** "<path to db>-journal-NNNN" - ** "<path to db>-wal-NNNN" + ** "<path to db>-journalNN" + ** "<path to db>-walNN" ** - ** where NNNN is a 4 digit decimal number. The NNNN naming schemes are + ** where NN is a 4 digit decimal number. The NN naming schemes are ** used by the test_multiplex.c module. */ nDb = sqlite3Strlen30(zPath) - 1; - while( nDb>0 && zPath[nDb]!='l' ) nDb--; - nDb -= ((flags & SQLITE_OPEN_WAL) ? 3 : 7); + while( nDb>0 && zPath[nDb]!='-' ) nDb--; + if( nDb==0 ) return SQLITE_OK; memcpy(zDb, zPath, nDb); zDb[nDb] = '\0'; @@ -4864,8 +4871,6 @@ static int findCreateFileMode( } }else if( flags & SQLITE_OPEN_DELETEONCLOSE ){ *pMode = 0600; - }else{ - *pMode = SQLITE_DEFAULT_FILE_PERMISSIONS; } return rc; } |