* lib/stdio.in.h: Include <unistd.h> on Solaris.
* lib/renameat.c: Don't include <unistd.h> here.
* doc/posix-functions/renameat.texi: Mention the Solaris problem.
Reported by Paul Eggert and Eric Blake.
+2010-10-26 Bruno Haible <bruno@clisp.org>
+
+ stdio: Work around compilation error due to renameat() on Solaris 10.
+ * lib/stdio.in.h: Include <unistd.h> on Solaris.
+ * lib/renameat.c: Don't include <unistd.h> here.
+ * doc/posix-functions/renameat.texi: Mention the Solaris problem.
+ Reported by Paul Eggert and Eric Blake.
+
2010-10-26 Paul Eggert <eggert@cs.ucla.edu>
renameat: port to Solaris 10, which declares renameat in unistd.h
such that @code{renameat(fd,"link/",fd,"new")} corrupts @file{link}:
Solaris 9.
@item
+This function is declared in @code{<unistd.h>} instead of @code{<stdio.h>}
+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,
#include <config.h>
-/* 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 <unistd.h>
-
#include <stdio.h>
#if HAVE_RENAMEAT
# endif
#endif
+/* Solaris 10 declares renameat in <unistd.h>, not in <stdio.h>. */
+/* But in any case avoid namespace pollution on glibc systems. */
+#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __sun \
+ && ! defined __GLIBC__
+# include <unistd.h>
+#endif
+
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */