X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Ffstatat.c;h=845c171fb459eb328ecd02ea0424b7df6e6e6595;hb=e7086a9a301ffcfef17edbcba9e7c0312c33f7a8;hp=326ce215a7bbcc6bb8ab92e92bd6955b3daedecf;hpb=204072b3f5a110d1225d81ca6a929c9f7b76029f;p=gnulib.git diff --git a/lib/fstatat.c b/lib/fstatat.c index 326ce215a..845c171fb 100644 --- a/lib/fstatat.c +++ b/lib/fstatat.c @@ -1,6 +1,6 @@ /* Work around an fstatat bug on Solaris 9. - Copyright (C) 2006, 2009-2011 Free Software Foundation, Inc. + Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -29,20 +29,23 @@ #undef __need_system_sys_stat_h #if HAVE_FSTATAT -static inline int +static int orig_fstatat (int fd, char const *filename, struct stat *buf, int flags) { return fstatat (fd, filename, buf, flags); } #endif -#include +/* Write "sys/stat.h" here, not , otherwise OSF/1 5.1 DTK cc + eliminates this include because of the preliminary #include + above. */ +#include "sys/stat.h" #include #include #include -#if HAVE_FSTATAT && !FSTATAT_ZERO_FLAG_BROKEN +#if HAVE_FSTATAT && HAVE_WORKING_FSTATAT_ZERO_FLAG # ifndef LSTAT_FOLLOWS_SLASHED_SYMLINK # define LSTAT_FOLLOWS_SLASHED_SYMLINK 0 @@ -87,20 +90,20 @@ rpl_fstatat (int fd, char const *file, struct stat *st, int flag) return result; } -#else /* !HAVE_FSTATAT || FSTATAT_ZERO_FLAG_BROKEN */ +#else /* ! (HAVE_FSTATAT && HAVE_WORKING_FSTATAT_ZERO_FLAG) */ -/* On mingw, the gnulib defines `stat' as a function-like +/* On mingw, the gnulib defines 'stat' as a function-like macro; but using it in AT_FUNC_F2 causes compilation failure because the preprocessor sees a use of a macro that requires two arguments but is only given one. Hence, we need an inline forwarder to get past the preprocessor. */ -static inline int +static int stat_func (char const *name, struct stat *st) { return stat (name, st); } -/* Likewise, if there is no native `lstat', then the gnulib +/* Likewise, if there is no native 'lstat', then the gnulib defined it as stat, which also needs adjustment. */ # if !HAVE_LSTAT # undef lstat @@ -115,11 +118,7 @@ stat_func (char const *name, struct stat *st) then give a diagnostic and exit nonzero. Otherwise, this function works just like Solaris' fstatat. */ -# if FSTATAT_ZERO_FLAG_BROKEN -# define AT_FUNC_NAME rpl_fstatat -# else -# define AT_FUNC_NAME fstatat -# endif +# define AT_FUNC_NAME fstatat # define AT_FUNC_F1 lstat # define AT_FUNC_F2 stat_func # define AT_FUNC_USE_F1_COND AT_SYMLINK_NOFOLLOW