>From 239485d0b3f04fd9ba8d3bd4bb99473b00ab9078 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 24 Jan 2019 23:51:11 +0100 Subject: [PATCH 2/7] fchownat: Fix compilation error on Android 4.3. * lib/unistd.in.h: Include when module 'fchownat' is in use. * m4/fchownat.m4 (gl_FUNC_FCHOWNAT_DEREF_BUG, gl_FUNC_FCHOWNAT_EMPTY_FILENAME_BUG): Include also . * doc/posix-functions/fchownat.texi: Mention the issue. --- ChangeLog | 9 +++++++++ doc/posix-functions/fchownat.texi | 20 ++++++++++++-------- lib/unistd.in.h | 7 +++++++ m4/fchownat.m4 | 6 +++++- 4 files changed, 33 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7ba92a9..5606681 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2019-01-24 Bruno Haible + + fchownat: Fix compilation error on Android 4.3. + * lib/unistd.in.h: Include when module 'fchownat' is in + use. + * m4/fchownat.m4 (gl_FUNC_FCHOWNAT_DEREF_BUG, + gl_FUNC_FCHOWNAT_EMPTY_FILENAME_BUG): Include also . + * doc/posix-functions/fchownat.texi: Mention the issue. + 2019-01-23 Bruno Haible gnulib-tool: Support running testdirs on Android. diff --git a/doc/posix-functions/fchownat.texi b/doc/posix-functions/fchownat.texi index c33bdc4..47a7225 100644 --- a/doc/posix-functions/fchownat.texi +++ b/doc/posix-functions/fchownat.texi @@ -9,6 +9,18 @@ Gnulib module: fchownat 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, 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. Also, the replacement may fail to change +symlinks if @code{lchown} is unsupported, or fail altogether if address@hidden is unsupported. address@hidden +This function is declared in @code{}, not in @code{}, +on some platforms: +Android 4.3. address@hidden Some platforms fail to detect trailing slash on non-directories, as in @code{fchown(dir,"link-to-file/",uid,gid,flag)}: Solaris 9. @@ -19,14 +31,6 @@ Linux kernel 2.6.17. @item This function does not fail for an empty filename on some platforms: Linux with glibc < 2.11. address@hidden -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, 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. Also, the replacement may fail to change -symlinks if @code{lchown} is unsupported, or fail altogether if address@hidden is unsupported. @end itemize Portability problems not fixed by Gnulib: diff --git a/lib/unistd.in.h b/lib/unistd.in.h index 49e5673..eb2534e 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -113,6 +113,13 @@ # include #endif +/* Android 4.3 declares fchownat in , not in . */ +/* But avoid namespace pollution on glibc systems. */ +#if (@GNULIB_FCHOWNAT@ || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \ + && !defined __GLIBC__ +# include +#endif + /* MSVC defines off_t in . May also define off_t to a 64-bit type on native Windows. */ #if address@hidden@ || @WINDOWS_64_BIT_OFF_T@ diff --git a/m4/fchownat.m4 b/m4/fchownat.m4 index 5cca8b5..023e3cb 100644 --- a/m4/fchownat.m4 +++ b/m4/fchownat.m4 @@ -1,4 +1,4 @@ -# fchownat.m4 serial 2 +# fchownat.m4 serial 3 dnl Copyright (C) 2004-2019 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -56,6 +56,8 @@ AC_DEFUN([gl_FUNC_FCHOWNAT_DEREF_BUG], [[ #include #include +/* Android 4.3 declares fchownat() in instead. */ +#include #include #include #include @@ -86,6 +88,8 @@ AC_DEFUN([gl_FUNC_FCHOWNAT_EMPTY_FILENAME_BUG], [AC_LANG_PROGRAM( [[#include #include + /* Android 4.3 declares fchownat() in instead. */ + #include ]], [[int fd; int ret; -- 2.7.4