# HG changeset patch # User Bruno Haible # Date 1288140822 -7200 # Node ID 805b81dc0827b5f6e7e762dc6978b47212ea47b1 # Parent 061d4549f2bc487668300174b634ef0c982de422 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. diff --git a/ChangeLog b/ChangeLog --- 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 --- a/doc/posix-functions/renameat.texi +++ b/doc/posix-functions/renameat.texi @@ -17,6 +17,10 @@ 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 --- 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 --- 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. */