Quoting Natanael Copa ([email protected]): > utmpx.h is specified in POSIX but utmpxname is not so we check for > utmpxname in configure script. > > This fixes the following compile error with musl libc: > lxcutmp.c: In function 'utmp_get_runlevel': > lxcutmp.c:249:2: error: implicit declaration of function 'utmpxname' > [-Werror=implicit-function-declaration] > if (!access(path, F_OK) && !utmpxname(path)) > ^ > > Signed-off-by: Natanael Copa <[email protected]>
Acked-by: Serge E. Hallyn <[email protected]> > --- > configure.ac | 2 +- > src/lxc/lxcutmp.c | 31 +++++++++++++++++++------------ > 2 files changed, 20 insertions(+), 13 deletions(-) > > diff --git a/configure.ac b/configure.ac > index f6c95c1..c9d1f06 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -521,7 +521,7 @@ AC_CHECK_FUNCS([setns pivot_root sethostname unshare > rand_r confstr]) > AC_CHECK_LIB(pthread, main) > AC_CHECK_FUNCS(pthread_atfork) > AC_CHECK_LIB(util, openpty) > -AC_CHECK_FUNCS([openpty hasmntopt setmntent endmntent]) > +AC_CHECK_FUNCS([openpty hasmntopt setmntent endmntent utmpxname]) > AC_CHECK_FUNCS([getline], > AM_CONDITIONAL(HAVE_GETLINE, true) > AC_DEFINE(HAVE_GETLINE,1,[Have getline]), > diff --git a/src/lxc/lxcutmp.c b/src/lxc/lxcutmp.c > index 6c9e6f2..15dd71c 100644 > --- a/src/lxc/lxcutmp.c > +++ b/src/lxc/lxcutmp.c > @@ -68,6 +68,10 @@ static int timerfd_settime (int __ufd, int __flags, > #endif > #ifdef HAVE_UTMPX_H > #include <utmpx.h> > +#ifndef HAVE_UTMPXNAME > +#include <utmp.h> > +#endif > + > #else > #include <utmp.h> > > @@ -75,18 +79,6 @@ static int timerfd_settime (int __ufd, int __flags, > #define RUN_LVL 1 > #endif > > -static int utmpxname(const char *file) { > - int result; > - result = utmpname(file); > - > -#ifdef IS_BIONIC > - /* Yeah bionic is that weird */ > - result = result - 1; > -#endif > - > - return result; > -} > - > static void setutxent(void) { > return setutent(); > } > @@ -104,6 +96,21 @@ static void endutxent (void) { > #endif > } > #endif > + > +#ifndef HAVE_UTMPXNAME > +static int utmpxname(const char *file) { > + int result; > + result = utmpname(file); > + > +#ifdef IS_BIONIC > + /* Yeah bionic is that weird */ > + result = result - 1; > +#endif > + > + return result; > +} > +#endif > + > #undef __USE_GNU > > /* This file watches the /var/run/utmp file in the container > -- > 1.8.5.3 > > _______________________________________________ > lxc-devel mailing list > [email protected] > http://lists.linuxcontainers.org/listinfo/lxc-devel _______________________________________________ lxc-devel mailing list [email protected] http://lists.linuxcontainers.org/listinfo/lxc-devel
