From: Bruno Haible Date: Wed, 11 Jan 2023 19:39:55 +0000 (+0100) Subject: perror: Fix "perror clobbers strerror's buffer" problem on Android. X-Git-Tag: v1.0~1854 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=b19433a961e6b10c112e98f2b9d3184bb8d091bd;p=gnulib.git perror: Fix "perror clobbers strerror's buffer" problem on Android. * m4/perror.m4 (gl_FUNC_PERROR): Set REPLACE_PERROR to 1 on Android. * doc/posix-functions/perror.texi: Mention the Android problem. --- diff --git a/ChangeLog b/ChangeLog index 537b5526b7..6374953ac6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2023-01-11 Bruno Haible + + perror: Fix "perror clobbers strerror's buffer" problem on Android. + * m4/perror.m4 (gl_FUNC_PERROR): Set REPLACE_PERROR to 1 on Android. + * doc/posix-functions/perror.texi: Mention the Android problem. + 2023-01-11 Bruno Haible posix_spawn_file_actions_addfchdir tests: Fix test failure on Android. diff --git a/doc/posix-functions/perror.texi b/doc/posix-functions/perror.texi index bbc2925d60..4c4a7e36dd 100644 --- a/doc/posix-functions/perror.texi +++ b/doc/posix-functions/perror.texi @@ -18,7 +18,7 @@ requires that the message declare it as a success, on some platforms: FreeBSD 8.2, OpenBSD 4.7, macOS 11.1. @item This function clobbers the @code{strerror} buffer on some platforms: -Cygwin 1.7.9. +Cygwin 1.7.9, Android 11. @item This function fails to print a useful a string for out-of-range integers on some platforms: diff --git a/m4/perror.m4 b/m4/perror.m4 index 3ff029de76..2545cb3487 100644 --- a/m4/perror.m4 +++ b/m4/perror.m4 @@ -1,4 +1,4 @@ -# perror.m4 serial 10 +# perror.m4 serial 11 dnl Copyright (C) 2008-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -10,7 +10,7 @@ AC_DEFUN([gl_FUNC_PERROR], AC_REQUIRE([gl_HEADER_ERRNO_H]) AC_REQUIRE([gl_FUNC_STRERROR_R]) AC_REQUIRE([gl_FUNC_STRERROR_0]) - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_REQUIRE([AC_CANONICAL_HOST]) dnl We intentionally do not check for the broader REPLACE_STRERROR_R, dnl since on glibc systems, strerror_r is replaced only for signature dnl issues, and perror is just fine. Rather, we only want to @@ -68,4 +68,9 @@ AC_DEFUN([gl_FUNC_PERROR], REPLACE_PERROR=1 ;; esac + dnl Does perror clobber the strerror buffer? + case "$host_os" in + # Yes on Android 11. + linux*-android*) REPLACE_PERROR=1 ;; + esac ])