Mercurial > hg > octave-kai > gnulib-hg
changeset 13827:805b81dc0827
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.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Wed, 27 Oct 2010 02:53:42 +0200 |
parents | 061d4549f2bc |
children | 54a5acffcb53 |
files | ChangeLog doc/posix-functions/renameat.texi lib/renameat.c lib/stdio.in.h |
diffstat | 4 files changed, 19 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +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
--- 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{<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,
--- a/lib/renameat.c +++ b/lib/renameat.c @@ -18,12 +18,6 @@ #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
--- a/lib/stdio.in.h +++ b/lib/stdio.in.h @@ -57,6 +57,13 @@ # 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. */