/* fstatat should always follow symbolic links that end in /, but on
Solaris 9 it doesn't if AT_SYMLINK_NOFOLLOW is specified.
Likewise, trailing slash on a non-directory should be an error.
These are the same problems that lstat.c and stat.c address, so
/* fstatat should always follow symbolic links that end in /, but on
Solaris 9 it doesn't if AT_SYMLINK_NOFOLLOW is specified.
Likewise, trailing slash on a non-directory should be an error.
These are the same problems that lstat.c and stat.c address, so
- solve it in a similar way. */
+ solve it in a similar way.
+
+ AIX 7.1 fstatat (AT_FDCWD, ..., 0) always fails, which is a bug.
+ Work around this bug if FSTATAT_AT_FDCWD_0_BROKEN is nonzero. */
int
rpl_fstatat (int fd, char const *file, struct stat *st, int flag)
int
rpl_fstatat (int fd, char const *file, struct stat *st, int flag)
int result = orig_fstatat (fd, file, st, flag);
size_t len;
int result = orig_fstatat (fd, file, st, flag);
size_t len;
- result = fstatat (fd, file, st, flag & ~AT_SYMLINK_NOFOLLOW);
+ result = orig_fstatat (fd, file, st, flag & ~AT_SYMLINK_NOFOLLOW);
/* On mingw, the gnulib <sys/stat.h> defines `stat' as a function-like
macro; but using it in AT_FUNC_F2 causes compilation failure
/* On mingw, the gnulib <sys/stat.h> defines `stat' as a function-like
macro; but using it in AT_FUNC_F2 causes compilation failure
then give a diagnostic and exit nonzero.
Otherwise, this function works just like Solaris' fstatat. */
then give a diagnostic and exit nonzero.
Otherwise, this function works just like Solaris' fstatat. */
# define AT_FUNC_F1 lstat
# define AT_FUNC_F2 stat_func
# define AT_FUNC_USE_F1_COND AT_SYMLINK_NOFOLLOW
# define AT_FUNC_F1 lstat
# define AT_FUNC_F2 stat_func
# define AT_FUNC_USE_F1_COND AT_SYMLINK_NOFOLLOW