From fde406769e0b55fef29159566facb14d49619b8d Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 12 Mar 2011 12:39:06 +0100 Subject: [PATCH] futimens, utimensat: Avoid endless recursion on Solaris 10. * lib/sys_stat.in.h (futimens, utimensat): Define with rpl_ prefix on Solaris. Reported by Ben Walton via Eric Blake in . --- ChangeLog | 8 ++++++++ lib/sys_stat.in.h | 16 ++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ba7252ab83..66c95a9a85 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2011-03-12 Bruno Haible + + futimens, utimensat: Avoid endless recursion on Solaris 10. + * lib/sys_stat.in.h (futimens, utimensat): Define with rpl_ prefix on + Solaris. + Reported by Ben Walton via Eric Blake + in . + 2011-03-11 Jim Meyering maint.mk: relax a regexp to accommodate other formatting styles diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h index 2853287d80..22cde114e7 100644 --- a/lib/sys_stat.in.h +++ b/lib/sys_stat.in.h @@ -355,7 +355,11 @@ _GL_WARN_ON_USE (fstatat, "fstatat is not portable - " #if @GNULIB_FUTIMENS@ -# if @REPLACE_FUTIMENS@ +/* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our futimens + implementation relies on futimesat, which on Solaris 10 makes an invocation + to futimens that is meant to invoke the libc's futimens(), not gnulib's + futimens(). */ +# if @REPLACE_FUTIMENS@ || defined __sun # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef futimens # define futimens rpl_futimens @@ -368,7 +372,9 @@ _GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2])); # endif _GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2])); # endif +# if @HAVE_FUTIMENS@ _GL_CXXALIASWARN (futimens); +# endif #elif defined GNULIB_POSIXCHECK # undef futimens # if HAVE_RAW_DECL_FUTIMENS @@ -612,7 +618,11 @@ _GL_WARN_ON_USE (stat, "stat is unportable - " #if @GNULIB_UTIMENSAT@ -# if @REPLACE_UTIMENSAT@ +/* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our utimensat + implementation relies on futimesat, which on Solaris 10 makes an invocation + to utimensat that is meant to invoke the libc's utimensat(), not gnulib's + utimensat(). */ +# if @REPLACE_UTIMENSAT@ || defined __sun # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef utimensat # define utimensat rpl_utimensat @@ -631,7 +641,9 @@ _GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name, _GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name, struct timespec const times[2], int flag)); # endif +# if @HAVE_UTIMENSAT@ _GL_CXXALIASWARN (utimensat); +# endif #elif defined GNULIB_POSIXCHECK # undef utimensat # if HAVE_RAW_DECL_UTIMENSAT -- 2.30.2