Commit 8b6d8b71 by Natanael Copa Committed by Stéphane Graber

Check for non-posix utmpxname in configure

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: 's avatarNatanael Copa <ncopa@alpinelinux.org> Acked-by: 's avatarSerge E. Hallyn <serge.hallyn@ubuntu.com>
parent 47add7e5
...@@ -521,7 +521,7 @@ AC_CHECK_FUNCS([setns pivot_root sethostname unshare rand_r confstr]) ...@@ -521,7 +521,7 @@ AC_CHECK_FUNCS([setns pivot_root sethostname unshare rand_r confstr])
AC_CHECK_LIB(pthread, main) AC_CHECK_LIB(pthread, main)
AC_CHECK_FUNCS(pthread_atfork) AC_CHECK_FUNCS(pthread_atfork)
AC_CHECK_LIB(util, openpty) AC_CHECK_LIB(util, openpty)
AC_CHECK_FUNCS([openpty hasmntopt setmntent endmntent]) AC_CHECK_FUNCS([openpty hasmntopt setmntent endmntent utmpxname])
AC_CHECK_FUNCS([getline], AC_CHECK_FUNCS([getline],
AM_CONDITIONAL(HAVE_GETLINE, true) AM_CONDITIONAL(HAVE_GETLINE, true)
AC_DEFINE(HAVE_GETLINE,1,[Have getline]), AC_DEFINE(HAVE_GETLINE,1,[Have getline]),
......
...@@ -68,6 +68,10 @@ static int timerfd_settime (int __ufd, int __flags, ...@@ -68,6 +68,10 @@ static int timerfd_settime (int __ufd, int __flags,
#endif #endif
#ifdef HAVE_UTMPX_H #ifdef HAVE_UTMPX_H
#include <utmpx.h> #include <utmpx.h>
#ifndef HAVE_UTMPXNAME
#include <utmp.h>
#endif
#else #else
#include <utmp.h> #include <utmp.h>
...@@ -75,18 +79,6 @@ static int timerfd_settime (int __ufd, int __flags, ...@@ -75,18 +79,6 @@ static int timerfd_settime (int __ufd, int __flags,
#define RUN_LVL 1 #define RUN_LVL 1
#endif #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) { static void setutxent(void) {
return setutent(); return setutent();
} }
...@@ -104,6 +96,21 @@ static void endutxent (void) { ...@@ -104,6 +96,21 @@ static void endutxent (void) {
#endif #endif
} }
#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 #undef __USE_GNU
/* This file watches the /var/run/utmp file in the container /* This file watches the /var/run/utmp file in the container
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment