futimens, utimensat: Avoid endless recursion on Solaris 10.
authorBruno Haible <bruno@clisp.org>
Sat, 12 Mar 2011 11:39:06 +0000 (12:39 +0100)
committerBruno Haible <bruno@clisp.org>
Sat, 12 Mar 2011 11:57:06 +0000 (12:57 +0100)
* lib/sys_stat.in.h (futimens, utimensat): Define with rpl_ prefix on
Solaris.
Reported by Ben Walton <bwalton@artsci.utoronto.ca> via Eric Blake
in <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8230>.

ChangeLog
lib/sys_stat.in.h

index ba7252ab83a1dac7c01f36e7903b41959bc9f188..66c95a9a850294c2afa163718f635969c705944a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-03-12  Bruno Haible  <bruno@clisp.org>
+
+       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 <bwalton@artsci.utoronto.ca> via Eric Blake
+       in <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8230>.
+
 2011-03-11  Jim Meyering  <meyering@redhat.com>
 
        maint.mk: relax a regexp to accommodate other formatting styles
index 2853287d80ec13474b9710f82038f91b3f65d1d0..22cde114e796a4a5a9496c31738f72a384835356 100644 (file)
@@ -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