From 96e8eebf96fb2fe0f5ab91526fa6ea2b5486f559 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 26 Dec 2019 00:56:50 +0000 Subject: =?UTF-8?q?In=20the=20xAccess()=20method=20of=20the=20unix=20VFS,?= =?UTF-8?q?=20return=20true=20if=20the=20named=20object=20is=20a=20directo?= =?UTF-8?q?ry,=20regardless=20of=20what=20stat()=20reports=20as=20the=20st?= =?UTF-8?q?=5Fsize=20for=20the=20object.=20=20Different=20filesystems=20re?= =?UTF-8?q?port=20st=5Fsize=20differently=20for=20directories.=20Problem?= =?UTF-8?q?=20reported=20on=20the=20mailing=20list=20by=20Stefan=20Br?= =?UTF-8?q?=C3=BCns.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FossilOrigin-Name: c8c6dd0e6582ec9103d007b294c42bb1820be1fa7dab85d873b04e0b90571626 --- src/os_unix.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/os_unix.c') diff --git a/src/os_unix.c b/src/os_unix.c index 18f2afcb6..e6d58811c 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -6259,7 +6259,8 @@ static int unixAccess( if( flags==SQLITE_ACCESS_EXISTS ){ struct stat buf; - *pResOut = (0==osStat(zPath, &buf) && buf.st_size>0); + *pResOut = 0==osStat(zPath, &buf) && + (S_ISDIR(buf.st_mode) || buf.st_size>0); }else{ *pResOut = osAccess(zPath, W_OK|R_OK)==0; } -- cgit v1.2.3 From 09bee5743dc30891e08591f237c23c6964c0a0aa Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 27 Dec 2019 13:30:46 +0000 Subject: Follow-up to check-in [c8c6dd0e6582ec91] - change the xAccess() method to return true if the file exists and it is anything other than a regular file, or if it is a regular file with a non-zero file size. FossilOrigin-Name: 8a39803ef8db4d8cb0d231e66299525fad4e61266ca29b3704aebb88df1c745b --- src/os_unix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/os_unix.c') diff --git a/src/os_unix.c b/src/os_unix.c index e6d58811c..07ae4bc03 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -6260,7 +6260,7 @@ static int unixAccess( if( flags==SQLITE_ACCESS_EXISTS ){ struct stat buf; *pResOut = 0==osStat(zPath, &buf) && - (S_ISDIR(buf.st_mode) || buf.st_size>0); + (!S_ISREG(buf.st_mode) || buf.st_size>0); }else{ *pResOut = osAccess(zPath, W_OK|R_OK)==0; } -- cgit v1.2.3