diff lib/unistd.in.h @ 40129:fc1768dc2fc5

fchownat: Fix compilation error on Android 4.3. * lib/unistd.in.h: Include <sys/stat.h> when module 'fchownat' is in use. * m4/fchownat.m4 (gl_FUNC_FCHOWNAT_DEREF_BUG, gl_FUNC_FCHOWNAT_EMPTY_FILENAME_BUG): Include also <sys/stat.h>. * doc/posix-functions/fchownat.texi: Mention the issue.
author Bruno Haible <bruno@clisp.org>
date Thu, 24 Jan 2019 23:51:11 +0100
parents b06060465f09
children 9c7eed94d112
line wrap: on
line diff
--- a/lib/unistd.in.h	Wed Jan 23 05:11:54 2019 +0100
+++ b/lib/unistd.in.h	Thu Jan 24 23:51:11 2019 +0100
@@ -113,6 +113,13 @@
 # include <netdb.h>
 #endif
 
+/* Android 4.3 declares fchownat in <sys/stat.h>, not in <unistd.h>.  */
+/* But avoid namespace pollution on glibc systems.  */
+#if (@GNULIB_FCHOWNAT@ || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \
+    && !defined __GLIBC__
+# include <sys/stat.h>
+#endif
+
 /* MSVC defines off_t in <sys/types.h>.
    May also define off_t to a 64-bit type on native Windows.  */
 #if !@HAVE_UNISTD_H@ || @WINDOWS_64_BIT_OFF_T@