]> Savannah Git Hosting - gnulib.git/commitdiff
readutmp, boot-time: Fix compilation error on old Android.
authorBruno Haible <bruno@clisp.org>
Sun, 13 Aug 2023 13:39:09 +0000 (15:39 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 13 Aug 2023 13:39:09 +0000 (15:39 +0200)
Reported by Po Lu in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-08/msg00108.html>.

* lib/readutmp.c (endutent): New fallback declaration, for Android.
(getutent): Remove Ultrix workaround from 2000-04-05.
* lib/boot-time.c: Likewise.
* m4/readutmp.m4 (gl_PREREQ_READUTMP_H): Test whether endutent is
declared, not getutent.
* doc/glibc-functions/endutent.texi: Mention the Android bug.

ChangeLog
doc/glibc-functions/endutent.texi
lib/boot-time.c
lib/readutmp.c
m4/readutmp.m4

index 252f302a59ecff171b652ec83552be52e96d47c2..9b4f07a2b1ada3693c6f67c53873768c6701f0a7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2023-08-13  Bruno Haible  <bruno@clisp.org>
+
+       readutmp, boot-time: Fix compilation error on old Android.
+       Reported by Po Lu in
+       <https://lists.gnu.org/archive/html/bug-gnulib/2023-08/msg00108.html>.
+       * lib/readutmp.c (endutent): New fallback declaration, for Android.
+       (getutent): Remove Ultrix workaround from 2000-04-05.
+       * lib/boot-time.c: Likewise.
+       * m4/readutmp.m4 (gl_PREREQ_READUTMP_H): Test whether endutent is
+       declared, not getutent.
+       * doc/glibc-functions/endutent.texi: Mention the Android bug.
+
 2023-08-12  Paul Eggert  <eggert@cs.ucla.edu>
 
        boot-time,readutmp: do not depend on c-strtod
index 5e12e23c44af62ea11e034a69d6469767bb2456e..b4f3dd397a9e8cba86eecabb7453efeb6e52b903 100644 (file)
@@ -28,4 +28,7 @@ Portability problems not fixed by Gnulib:
 @item
 This function is missing on some platforms:
 macOS 11.1, FreeBSD 13.0, OpenBSD 6.7, Minix 3.1.8, mingw, MSVC 14.
+@item
+This function is not declared on some platforms:
+Android before ca.@: 2015.
 @end itemize
index d813bfa5825702f6ac249353b38c6831a216e11b..c359954f19753d3622233d8880d1329faa13372f 100644 (file)
 # define UT_USER(UT) ((UT)->ut_user)
 #endif
 
-#if !HAVE_UTMPX_H && HAVE_UTMP_H && defined UTMP_NAME_FUNCTION && !HAVE_DECL_GETUTENT
-struct utmp *getutent (void);
+#if !HAVE_UTMPX_H && HAVE_UTMP_H && defined UTMP_NAME_FUNCTION
+# if !HAVE_DECL_ENDUTENT /* Android */
+void endutent (void);
+# endif
 #endif
 
 #if defined __linux__ || HAVE_UTMPX_H || HAVE_UTMP_H || defined __CYGWIN__ || defined _WIN32
index ef9f0aff43415f02b79479158bd980b23cc0cc8d..0b7732b1658648ed24e1bb91e53384693f791592 100644 (file)
@@ -314,9 +314,11 @@ have_boot_time (struct utmp_alloc a)
   return false;
 }
 
-# if !HAVE_UTMPX_H && HAVE_UTMP_H && defined UTMP_NAME_FUNCTION && !HAVE_DECL_GETUTENT
-struct utmp *getutent (void);
+#if !HAVE_UTMPX_H && HAVE_UTMP_H && defined UTMP_NAME_FUNCTION
+# if !HAVE_DECL_ENDUTENT /* Android */
+void endutent (void);
 # endif
+#endif
 
 static int
 read_utmp_from_file (char const *file, idx_t *n_entries, STRUCT_UTMP **utmp_buf,
index fff8d4eb7bf92d6d1a2dc40266d5579b847fb012..9dffe981b8cafda48660c722d6f2baae7d8d0a00 100644 (file)
@@ -1,4 +1,4 @@
-# readutmp.m4 serial 28
+# readutmp.m4 serial 29
 dnl Copyright (C) 2002-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,
@@ -55,7 +55,7 @@ AC_DEFUN_ONCE([gl_PREREQ_READUTMP_H],
   if test $ac_cv_header_utmp_h = yes || test $ac_cv_header_utmpx_h = yes; then
     dnl Prerequisites of lib/readutmp.h and lib/readutmp.c.
     AC_CHECK_FUNCS_ONCE([utmpname utmpxname])
-    AC_CHECK_DECLS([getutent],,,[[
+    AC_CHECK_DECLS([endutent],,,[[
 /* <sys/types.h> is a prerequisite of <utmp.h> on FreeBSD 8.0, OpenBSD 4.6.  */
 #include <sys/types.h>
 #ifdef HAVE_UTMP_H