Fix compiling with musl's utmp stubs

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>
This commit is contained in:
Kylie McClain 2016-02-01 01:36:05 +01:00 committed by Denys Vlasenko
parent 4a79224cfc
commit 40eea690c7
4 changed files with 5 additions and 3 deletions

View File

@ -20,6 +20,7 @@
#include <netdb.h> #include <netdb.h>
#include <setjmp.h> #include <setjmp.h>
#include <signal.h> #include <signal.h>
#include <paths.h>
#if defined __UCLIBC__ /* TODO: and glibc? */ #if defined __UCLIBC__ /* TODO: and glibc? */
/* use inlined versions of these: */ /* use inlined versions of these: */
# define sigfillset(s) __sigfillset(s) # define sigfillset(s) __sigfillset(s)
@ -106,7 +107,11 @@
# define updwtmpx updwtmp # define updwtmpx updwtmp
# define _PATH_UTMPX _PATH_UTMP # define _PATH_UTMPX _PATH_UTMP
# else # else
# include <utmp.h>
# include <utmpx.h> # include <utmpx.h>
# if defined _PATH_UTMP && !defined _PATH_UTMPX
# define _PATH_UTMPX _PATH_UTMP
# endif
# endif # endif
#endif #endif
#if ENABLE_LOCALE_SUPPORT #if ENABLE_LOCALE_SUPPORT

View File

@ -112,7 +112,6 @@
#include "libbb.h" #include "libbb.h"
#include <syslog.h> #include <syslog.h>
#include <paths.h>
#include <sys/resource.h> #include <sys/resource.h>
#ifdef __linux__ #ifdef __linux__
# include <linux/vt.h> # include <linux/vt.h>

View File

@ -37,7 +37,6 @@
#define JOBS ENABLE_ASH_JOB_CONTROL #define JOBS ENABLE_ASH_JOB_CONTROL
#include <paths.h>
#include <setjmp.h> #include <setjmp.h>
#include <fnmatch.h> #include <fnmatch.h>
#include <sys/times.h> #include <sys/times.h>

View File

@ -98,7 +98,6 @@ static void klogd_close(void)
#else #else
# include <paths.h>
# ifndef _PATH_KLOG # ifndef _PATH_KLOG
# ifdef __GNU__ # ifdef __GNU__
# define _PATH_KLOG "/dev/klog" # define _PATH_KLOG "/dev/klog"