From 82a0a56381ed6a9cf78f3b662735391209ce6dee Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 27 Oct 2010 02:53:42 +0200 Subject: [PATCH] stdio: Work around compilation error due to renameat() on Solaris 10. * lib/stdio.in.h: Include on Solaris. * lib/renameat.c: Don't include here. * doc/posix-functions/renameat.texi: Mention the Solaris problem. Reported by Paul Eggert and Eric Blake. --- ChangeLog | 8 ++++++++ doc/posix-functions/renameat.texi | 4 ++++ lib/renameat.c | 6 ------ lib/stdio.in.h | 7 +++++++ 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 38888bf12..d02876da1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2010-10-26 Bruno Haible + + stdio: Work around compilation error due to renameat() on Solaris 10. + * lib/stdio.in.h: Include on Solaris. + * lib/renameat.c: Don't include here. + * doc/posix-functions/renameat.texi: Mention the Solaris problem. + Reported by Paul Eggert and Eric Blake. + 2010-10-26 Paul Eggert renameat: port to Solaris 10, which declares renameat in unistd.h diff --git a/doc/posix-functions/renameat.texi b/doc/posix-functions/renameat.texi index e8eef3668..6100fb1c1 100644 --- a/doc/posix-functions/renameat.texi +++ b/doc/posix-functions/renameat.texi @@ -17,6 +17,10 @@ This function ignores trailing slashes on symlinks on some platforms, such that @code{renameat(fd,"link/",fd,"new")} corrupts @file{link}: Solaris 9. @item +This function is declared in @code{} instead of @code{} +on some platforms: +Solaris 10. +@item This function is missing on some platforms: glibc 2.3.6, MacOS X 10.3, FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 8, Cygwin 1.5.x, mingw, diff --git a/lib/renameat.c b/lib/renameat.c index 692fd52ae..f29476504 100644 --- a/lib/renameat.c +++ b/lib/renameat.c @@ -18,12 +18,6 @@ #include -/* Solaris 10, which predates POSIX-2008, declares its renameat in - unistd.h. Include unistd.h before including stdio.h, so that - gnulib's stdio.h doesn't #define renameat to rpl_renameat before - Solaris 10's unistd.h declares the system renameat. */ -#include - #include #if HAVE_RENAMEAT diff --git a/lib/stdio.in.h b/lib/stdio.in.h index efd2609d3..4da4b777d 100644 --- a/lib/stdio.in.h +++ b/lib/stdio.in.h @@ -57,6 +57,13 @@ # endif #endif +/* Solaris 10 declares renameat in , not in . */ +/* But in any case avoid namespace pollution on glibc systems. */ +#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __sun \ + && ! defined __GLIBC__ +# include +#endif + /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ -- 2.11.0