diff options
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; } |