* lib/access.c (access): When stat() returns -1 with errno != EOVERFLOW,
fail.
2023-10-03 Bruno Haible <bruno@clisp.org>
+ access: Make last change work also when module 'stat' is in use.
+ * lib/access.c (access): When stat() returns -1 with errno != EOVERFLOW,
+ fail.
+
access: Work around trailing slash bug on Mac OS X 10.5.
* m4/access.m4 (gl_FUNC_ACCESS): Test whether access honors a trailing
slash. Set REPLACE_ACCESS to 1 and define ACCESS_TRAILING_SLASH_BUG if
if (file_len > 0 && file[file_len - 1] == '/')
{
struct stat st;
- if (stat (file, &st) == 0 && ! S_ISDIR (st.st_mode))
+ if (stat (file, &st) == 0)
{
- errno = ENOTDIR;
- return -1;
+ if (! S_ISDIR (st.st_mode))
+ {
+ errno = ENOTDIR;
+ return -1;
+ }
}
+ else
+ return (mode == F_OK && errno == EOVERFLOW ? 0 : -1);
}
}
# endif