From 52cd509b57cb3d4bb4091729b5baa7a639495a26 Mon Sep 17 00:00:00 2001 From: Davin McCall Date: Fri, 3 May 2019 20:00:02 +1000 Subject: [PATCH] Slight re-work of Musl utmp support detection. --- src/includes/dinit-utmp.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/includes/dinit-utmp.h b/src/includes/dinit-utmp.h index 4499876..f02eca2 100644 --- a/src/includes/dinit-utmp.h +++ b/src/includes/dinit-utmp.h @@ -12,6 +12,11 @@ #ifndef USE_UTMPX #if __linux__ || __FreeBSD__ || __DragonFly__ #define USE_UTMPX 1 +#if __linux__ +// Should be safe to #include , but it may be stub implementation (Musl). Need to check +// that after include: +#define CHECK_UTMP_PATH 1 +#endif #else #define USE_UTMPX 0 #endif @@ -37,11 +42,14 @@ #include // Musl has a utmpx.h header but only stub implementations of the functions, and does not define _PATH_UTMPX // nor _PATH_WTMPX. +#if CHECK_UTMP_PATH +#undef CHECK_UTMP_PATH #if !defined(_PATH_UTMPX) || !defined(_PATH_WTMPX) #undef USE_UTMPX #define USE_UTMPX 0 #endif #endif +#endif #if USE_UTMPX -- 2.25.1