aboutsummaryrefslogtreecommitdiff
path: root/src/pager.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2019-11-22 00:42:01 +0000
committerdrh <drh@noemail.net>2019-11-22 00:42:01 +0000
commitc398c65bee850b6b8f24a44852872a27f114535d (patch)
tree400756f2c2735468faaa02daa969838df2854778 /src/pager.c
parentcd30064bd502b9b42a4e0c0e04850f09cefa2617 (diff)
downloadsqlite-c398c65bee850b6b8f24a44852872a27f114535d.tar.gz
sqlite-c398c65bee850b6b8f24a44852872a27f114535d.zip
Revise the SQLITE_OPEN_NOFOLLOW so that it actually uses O_NOFOLLOW in the
open() system call. This backs out the SQLITE_ACCESS_SYMLINK value but adds the new SQLITE_OK_SYMLINK return code from the xFullPathname method of sqlite3_vfs when that routine resolves symbolic links. O_NOFOLLOW is always included in open() system calls for journal files. FossilOrigin-Name: 6a64fb6a2da6c98f1e87b55ad5689967e1db4eae2e08345471d95e28cd567e0f
Diffstat (limited to 'src/pager.c')
-rw-r--r--src/pager.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/pager.c b/src/pager.c
index 67e757640..9d4922c4a 100644
--- a/src/pager.c
+++ b/src/pager.c
@@ -4790,12 +4790,6 @@ int sqlite3PagerOpen(
*/
if( zFilename && zFilename[0] ){
const char *z;
- if( (vfsFlags & SQLITE_OPEN_NOFOLLOW)!=0 ){
- int isLink = 0;
- int rc = sqlite3OsAccess(pVfs, zFilename, SQLITE_ACCESS_SYMLINK, &isLink);
- if( rc==SQLITE_OK && isLink ) rc = SQLITE_CANTOPEN_SYMLINK;
- if( rc ) return rc;
- }
nPathname = pVfs->mxPathname+1;
zPathname = sqlite3DbMallocRaw(0, nPathname*2);
if( zPathname==0 ){
@@ -4803,6 +4797,15 @@ int sqlite3PagerOpen(
}
zPathname[0] = 0; /* Make sure initialized even if FullPathname() fails */
rc = sqlite3OsFullPathname(pVfs, zFilename, nPathname, zPathname);
+ if( rc!=SQLITE_OK ){
+ if( rc==SQLITE_OK_SYMLINK ){
+ if( vfsFlags & SQLITE_OPEN_NOFOLLOW ){
+ rc = SQLITE_CANTOPEN_SYMLINK;
+ }else{
+ rc = SQLITE_OK;
+ }
+ }
+ }
nPathname = sqlite3Strlen30(zPathname);
z = zUri = &zFilename[sqlite3Strlen30(zFilename)+1];
while( *z ){