Fix compiling with musl's utmp stubs
authorKylie McClain <somasissounds@gmail.com>
Mon, 1 Feb 2016 00:36:05 +0000 (01:36 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Mon, 1 Feb 2016 00:36:05 +0000 (01:36 +0100)
This patch fixes compiling busybox with FEATURE_UTMP and _WTMP enabled.
musl, while not really support utmp/wtmp, provides stub functions, as well
as variables such as _PATH_UTMP, so that programs using utmp or wtmp can
still compile fine.

My reasoning for this patch is that on Exherbo, I'm currently trying to get
us to be able to use the same busybox config file for both glibc and musl
systems, using utmp/wtmp on systems that support it, and using the stubs
on musl without needing two different configs.

As of latest musl git, it provides all utmp functions needed; 1.1.12 doesn't,
but I sent a patch to Rich to add the utmp{,x}name functions expected to
exist, which was merged into musl upstream.

Signed-off-by: Kylie McClain <somasissounds@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
include/libbb.h
init/init.c
shell/ash.c
sysklogd/klogd.c

index 82484f9117adfab5297abdf99cd2c12fc0301b99..d05ac29769b04c673ea98854ac0f744fe713b7ee 100644 (file)
@@ -20,6 +20,7 @@
 #include <netdb.h>
 #include <setjmp.h>
 #include <signal.h>
+#include <paths.h>
 #if defined __UCLIBC__ /* TODO: and glibc? */
 /* use inlined versions of these: */
 # define sigfillset(s)    __sigfillset(s)
 #  define updwtmpx updwtmp
 #  define _PATH_UTMPX _PATH_UTMP
 # else
+#  include <utmp.h>
 #  include <utmpx.h>
+#  if defined _PATH_UTMP && !defined _PATH_UTMPX
+#   define _PATH_UTMPX _PATH_UTMP
+#  endif
 # endif
 #endif
 #if ENABLE_LOCALE_SUPPORT
index 80c5d0f74cb8fac6b1de810d9bf4897433a3e12f..2040a59e83536e8949ca48c5c4f47ae5221a78f9 100644 (file)
 
 #include "libbb.h"
 #include <syslog.h>
-#include <paths.h>
 #include <sys/resource.h>
 #ifdef __linux__
 # include <linux/vt.h>
index daec975c513f83e0f8bc1e61dc912650e8db505a..b5a2d961d9a481ec42b08f103b5dd36baf95f01d 100644 (file)
@@ -37,7 +37,6 @@
 
 #define JOBS ENABLE_ASH_JOB_CONTROL
 
-#include <paths.h>
 #include <setjmp.h>
 #include <fnmatch.h>
 #include <sys/times.h>
index ca8b848bd9f0a85e085c78baf14a48dc7700ceb8..03d65b37fb542862aca6199eb290b703034fdc14 100644 (file)
@@ -98,7 +98,6 @@ static void klogd_close(void)
 
 #else
 
-# include <paths.h>
 # ifndef _PATH_KLOG
 #  ifdef __GNU__
 #   define _PATH_KLOG "/dev/klog"