diff options
author | drh <drh@noemail.net> | 2019-11-18 17:46:38 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2019-11-18 17:46:38 +0000 |
commit | 0933aad72c5ac1a763891c03b231ce72b1d19b03 (patch) | |
tree | ace29f58dd8b9c2ac613cc8dad3c8fc4d47cc5a8 /src/os_unix.c | |
parent | 804725a6b9ea8ba9ef507866b1d8d2628d1e4356 (diff) | |
download | sqlite-0933aad72c5ac1a763891c03b231ce72b1d19b03.tar.gz sqlite-0933aad72c5ac1a763891c03b231ce72b1d19b03.zip |
Add support for SQLITE_OPEN_NOFOLLOW.
FossilOrigin-Name: cb79c828496a703f1410f61458ebc1e15a92a63412b36f51945b2b5a32ec6e88
Diffstat (limited to 'src/os_unix.c')
-rw-r--r-- | src/os_unix.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/os_unix.c b/src/os_unix.c index f2ac89f2c..7217a5d5f 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -6251,15 +6251,25 @@ static int unixAccess( SimulateIOError( return SQLITE_IOERR_ACCESS; ); assert( pResOut!=0 ); - /* The spec says there are three possible values for flags. But only - ** two of them are actually used */ - assert( flags==SQLITE_ACCESS_EXISTS || flags==SQLITE_ACCESS_READWRITE ); + /* The spec says there are four possible values for flags. But the + ** SQLITE_ACCESS_READ flag is never used */ + assert( flags==SQLITE_ACCESS_EXISTS + || flags==SQLITE_ACCESS_READWRITE + || flags==SQLITE_ACCESS_SYMLINK ); if( flags==SQLITE_ACCESS_EXISTS ){ struct stat buf; *pResOut = (0==osStat(zPath, &buf) && buf.st_size>0); - }else{ + }else if( flags==SQLITE_ACCESS_READWRITE ){ *pResOut = osAccess(zPath, W_OK|R_OK)==0; + }else{ +#if !defined(HAVE_LSTAT) + *pResOut = 0; +#else + struct stat buf; + *pResOut = (0==osLstat(zPath, &buf) && S_ISLNK(buf.st_mode)); +#endif + assert( flags==SQLITE_ACCESS_SYMLINK ); } return SQLITE_OK; } |