work around EPERM error from access()

On OS X, it seems that access() can sometimes fail with EPERM
when checking for execute permission on a file without it.
I've previously seen this result when running as the superuser,
but that's apparently not the only possibility; a long path
may also be relevant.
This commit is contained in:
Matthew Flatt 2015-08-01 21:48:06 -06:00
parent bfef7f54a3
commit bf76ced8ba

View File

@ -6088,12 +6088,10 @@ static Scheme_Object *file_or_dir_permissions(int argc, Scheme_Object *argv[])
} while ((ok == -1) && (errno == EINTR));
execute = !ok;
/* Don't fail at the exec step if the user is the
superuser and errno is EPERM; under Mac OS X,
at least, such a failure simply means tha the
file is not executable. */
if (ok && (errno != EACCES)
&& (uid || gid || (errno != EPERM))) {
/* Don't fail at the exec step if errno is EPERM; under Mac OS
X, at least, such a failure simply means that the file is
not executable. */
if (ok && (errno != EACCES) && (errno != EPERM)) {
l = NULL;
} else {
if (read)