1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Add support for SQLITE_OPEN_NOFOLLOW.

FossilOrigin-Name: cb79c828496a703f1410f61458ebc1e15a92a63412b36f51945b2b5a32ec6e88
This commit is contained in:
drh
2019-11-18 17:46:38 +00:00
parent 804725a6b9
commit 0933aad72c
12 changed files with 97 additions and 25 deletions

View File

@@ -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;
}