From 04c519234ca7838e7874d205cbbf93dd1ef3399b Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 13 Aug 2023 16:33:28 +0200 Subject: [PATCH] readutmp, boot-time: Fix compilation error on old Android. Reported by Po Lu in . * lib/readutmp.h (BOOT_TIME): Add fallback. --- ChangeLog | 7 +++++++ lib/readutmp.h | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/ChangeLog b/ChangeLog index 3b651bb4b8..4fec15de51 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2023-08-13 Bruno Haible + + readutmp, boot-time: Fix compilation error on old Android. + Reported by Po Lu in + . + * lib/readutmp.h (BOOT_TIME): Add fallback. + 2023-08-13 Bruno Haible readutmp, boot-time: Fix compilation error on Android API 8. diff --git a/lib/readutmp.h b/lib/readutmp.h index 1cf588d265..f7cad36d44 100644 --- a/lib/readutmp.h +++ b/lib/readutmp.h @@ -249,6 +249,13 @@ struct utmpx32 # define WTMP_FILE "/etc/wtmp" #endif +/* In early versions of Android, 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'. */ -- 2.39.5