/ Check-in [2e98b42f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:In the SQLITE_OPEN_NOFOLLOW processing, distinguish between an I/O error on the xAccess() call and an actual symlink encounter.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 2e98b42fcb7bc38e22808a9dc1d7a4231ed08ffa97c9f08f33e6e8cd8726856c
User & Date: drh 2019-11-18 18:43:19
Context
2019-11-18
22:34
Ensure all file names passed to the VFS layer are double-zero terminated. check-in: 251230cf user: mistachkin tags: trunk
18:43
In the SQLITE_OPEN_NOFOLLOW processing, distinguish between an I/O error on the xAccess() call and an actual symlink encounter. check-in: 2e98b42f user: drh tags: trunk
17:46
Add support for SQLITE_OPEN_NOFOLLOW. check-in: cb79c828 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/pager.c.

4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797

4798
4799
4800
4801
4802
4803
4804
  ** to by zPathname, length nPathname. Or, if this is a temporary file,
  ** leave both nPathname and zPathname set to 0.
  */
  if( zFilename && zFilename[0] ){
    const char *z;
    if( (vfsFlags & SQLITE_OPEN_NOFOLLOW)!=0 ){
      int isLink = 0;
      if( sqlite3OsAccess(pVfs, zFilename, SQLITE_ACCESS_SYMLINK, &isLink)==0
       && isLink
      ){
        return SQLITE_CANTOPEN_SYMLINK;
      }

    }
    nPathname = pVfs->mxPathname+1;
    zPathname = sqlite3DbMallocRaw(0, nPathname*2);
    if( zPathname==0 ){
      return SQLITE_NOMEM_BKPT;
    }
    zPathname[0] = 0; /* Make sure initialized even if FullPathname() fails */







|
<
<
|
<
>







4786
4787
4788
4789
4790
4791
4792
4793


4794

4795
4796
4797
4798
4799
4800
4801
4802
  ** to by zPathname, length nPathname. Or, if this is a temporary file,
  ** leave both nPathname and zPathname set to 0.
  */
  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 ){
      return SQLITE_NOMEM_BKPT;
    }
    zPathname[0] = 0; /* Make sure initialized even if FullPathname() fails */