From: Bruno Haible Date: Sun, 13 Aug 2023 14:33:28 +0000 (+0200) Subject: readutmp, boot-time: Fix compilation error on old Android. X-Git-Tag: v1.0~914 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=04c519234ca7838e7874d205cbbf93dd1ef3399b;p=gnulib.git readutmp, boot-time: Fix compilation error on old Android. Reported by Po Lu in . * lib/readutmp.h (BOOT_TIME): Add fallback. --- 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'. */