Slight re-work of Musl utmp support detection.
authorDavin McCall <davmac@davmac.org>
Fri, 3 May 2019 10:00:02 +0000 (20:00 +1000)
committerDavin McCall <davmac@davmac.org>
Fri, 3 May 2019 10:00:02 +0000 (20:00 +1000)
src/includes/dinit-utmp.h

index 44998767647e7c66257796918e9eceaa48ceabd0..f02eca242f90e63657b0aea2923b17892ddaf186 100644 (file)
 #ifndef USE_UTMPX
 #if __linux__ || __FreeBSD__ || __DragonFly__
 #define USE_UTMPX 1
+#if __linux__
+// Should be safe to #include <utmpx.h>, 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
 #include <utmpx.h>
 // 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