Fix for compilation with Musl. v0.5.0
authorDavin McCall <davmac@davmac.org>
Thu, 2 May 2019 11:41:15 +0000 (21:41 +1000)
committerDavin McCall <davmac@davmac.org>
Thu, 2 May 2019 11:42:08 +0000 (21:42 +1000)
Musl only has stub implementations of utmp* functions, and doesn't
define _PATH_UTMPX nor _PATH_WTMPX.

src/includes/dinit-utmp.h

index 579b1961dd9f057213f1729801ada5ce41a2a08d..44998767647e7c66257796918e9eceaa48ceabd0 100644 (file)
 #endif
 #endif
 
+#if USE_UTMPX
+#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 !defined(_PATH_UTMPX) || !defined(_PATH_WTMPX)
+#undef USE_UTMPX
+#define USE_UTMPX 0
+#endif
+#endif
+
 #if USE_UTMPX
 
 #include <cstring>
 
-#include <utmpx.h>
 #include <sys/time.h>
 
 // Set the time for a utmpx record to the current time.