]> Savannah Git Hosting - gnulib.git/commitdiff
renameat: Fix compilation error on Android 4.3.
authorBruno Haible <bruno@clisp.org>
Thu, 24 Jan 2019 23:03:12 +0000 (00:03 +0100)
committerBruno Haible <bruno@clisp.org>
Fri, 25 Jan 2019 01:14:26 +0000 (02:14 +0100)
* lib/stdio.in.h: Include <sys/stat.h> when module 'renameat' is in use.
* doc/posix-functions/renameat.texi: Mention the issue.

ChangeLog
doc/posix-functions/renameat.texi
lib/stdio.in.h

index 56066811850e5a876e849f97a76a95d876a7682c..fad53aee9cfe125f0937a9d98aac4ff55d418646 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+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.
index 1411e2ee1db395eb20a43eb51ce450d22cb9995c..bbd1110152fd7edb9a143fdfd7a32fe6db73a029 100644 (file)
@@ -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{<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.
@@ -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{<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:
index c7acb66b2e70d0f549b36356e6d9994660de9867..98c8093189961741ad168767aed80d297d5ccff5 100644 (file)
 # 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.  */