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

* lib/readutmp.h (BOOT_TIME): Add fallback.

ChangeLog
lib/readutmp.h

index 3b651bb4b82bfbe9953d376bb3c925d3898c5901..4fec15de519f8e00f1e1cfc2a5d38c98947bf438 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+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.h (BOOT_TIME): Add fallback.
+
 2023-08-13  Bruno Haible  <bruno@clisp.org>
 
        readutmp, boot-time: Fix compilation error on Android API 8.
index 1cf588d265bf4fb8e8a23f61e59ca1112a0c2723..f7cad36d4453ad627cfea247053a60b738a0541a 100644 (file)
@@ -249,6 +249,13 @@ struct utmpx32
 # define WTMP_FILE "/etc/wtmp"
 #endif
 
+/* In early versions of Android, <utmp.h> did not define BOOT_TIME, only
+   USER_PROCESS.  We need to use the value that is defined in newer versions
+   of Android.  */
+#if defined __ANDROID__ && !defined BOOT_TIME
+# define BOOT_TIME 2
+#endif
+
 /* Some platforms, such as OpenBSD, don't have an ut_type field and don't have
    the BOOT_TIME and USER_PROCESS macros.  But we want to support them in
    'struct gl_utmp'.  */