+2019-01-24 Bruno Haible <bruno@clisp.org>
+
+ renameat: Fix compilation error on Android 4.3.
+ * lib/stdio.in.h: Include <sys/stat.h> when module 'renameat' is in use.
+ * doc/posix-functions/renameat.texi: Mention the issue.
+
2019-01-24 Bruno Haible <bruno@clisp.org>
fchownat: Fix compilation error on Android 4.3.
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{<unistd.h>}, not in @code{<stdio.h>},
+on some platforms:
+NetBSD 7.0, Solaris 11.4.
+@item
+This function is declared in @code{<sys/stat.h>}, not in @code{<stdio.h>},
+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.
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{<unistd.h>} instead of @code{<stdio.h>}
-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:
# include <unistd.h>
#endif
+/* Android 4.3 declares renameat in <sys/stat.h>, not in <stdio.h>. */
+/* But in any case avoid namespace pollution on glibc systems. */
+#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \
+ && ! defined __GLIBC__
+# include <sys/stat.h>
+#endif
+
/* MSVC declares 'perror' in <stdlib.h>, not in <stdio.h>. We must include
it before we #define perror rpl_perror. */
/* But in any case avoid namespace pollution on glibc systems. */