From 1f9ed3993819c7be86c21a6593bba316bb1dfc64 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 25 Jan 2019 00:03:12 +0100 Subject: [PATCH] renameat: Fix compilation error on Android 4.3. * lib/stdio.in.h: Include when module 'renameat' is in use. * doc/posix-functions/renameat.texi: Mention the issue. --- ChangeLog | 6 ++++++ doc/posix-functions/renameat.texi | 25 +++++++++++++++---------- lib/stdio.in.h | 7 +++++++ 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5606681185..fad53aee9c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2019-01-24 Bruno Haible + + renameat: Fix compilation error on Android 4.3. + * lib/stdio.in.h: Include when module 'renameat' is in use. + * doc/posix-functions/renameat.texi: Mention the issue. + 2019-01-24 Bruno Haible fchownat: Fix compilation error on Android 4.3. diff --git a/doc/posix-functions/renameat.texi b/doc/posix-functions/renameat.texi index 1411e2ee1d..bbd1110152 100644 --- a/doc/posix-functions/renameat.texi +++ b/doc/posix-functions/renameat.texi @@ -9,6 +9,21 @@ Gnulib module: renameat Portability problems fixed by Gnulib: @itemize @item +This function is missing on some platforms: +glibc 2.3.6, Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, +AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 8, Cygwin 1.5.x, mingw, MSVC 14, +Interix 3.5, BeOS. +But the replacement function is not safe to be used in libraries and is not +multithread-safe. +@item +This function is declared in @code{}, not in @code{}, +on some platforms: +NetBSD 7.0, Solaris 11.4. +@item +This function is declared in @code{}, not in @code{}, +on some platforms: +Android 4.3. +@item This function does not reject trailing slashes on non-directories on some platforms, as in @code{renameat(fd,"file",fd,"new/")}: Solaris 11.4. @@ -16,16 +31,6 @@ Solaris 11.4. 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: -NetBSD 7.0, Solaris 11.4. -@item -This function is missing on some platforms: -glibc 2.3.6, Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, -AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 8, Cygwin 1.5.x, mingw, MSVC 14, -Interix 3.5, BeOS. -But the replacement function is not safe to be used in libraries and is not multithread-safe. @end itemize Portability problems not fixed by Gnulib: diff --git a/lib/stdio.in.h b/lib/stdio.in.h index c7acb66b2e..98c8093189 100644 --- a/lib/stdio.in.h +++ b/lib/stdio.in.h @@ -118,6 +118,13 @@ # include #endif +/* Android 4.3 declares renameat in , not in . */ +/* But in any case avoid namespace pollution on glibc systems. */ +#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \ + && ! defined __GLIBC__ +# include +#endif + /* MSVC declares 'perror' in , not in . We must include it before we #define perror rpl_perror. */ /* But in any case avoid namespace pollution on glibc systems. */ -- 2.39.5