Commit ffbf5815 by Stéphane Graber

Make utmpx.h optional

This adds code detecting the presence of utmpx.h and in its absence, turns the utmp related functions into no-ops. Signed-off-by: 's avatarStéphane Graber <stgraber@ubuntu.com> Acked-by: 's avatarSerge E. Hallyn <serge.hallyn@ubuntu.com>
parent 2d76d1d7
...@@ -221,7 +221,7 @@ AM_CONDITIONAL([IS_BIONIC], [test "x$is_bionic" = "xyes"]) ...@@ -221,7 +221,7 @@ AM_CONDITIONAL([IS_BIONIC], [test "x$is_bionic" = "xyes"])
AC_CHECK_DECLS([PR_CAPBSET_DROP], [], [], [#include <sys/prctl.h>]) AC_CHECK_DECLS([PR_CAPBSET_DROP], [], [], [#include <sys/prctl.h>])
# Check for some headers # Check for some headers
AC_CHECK_HEADERS([sys/signalfd.h pty.h sys/capability.h sys/personality.h]) AC_CHECK_HEADERS([sys/signalfd.h pty.h sys/capability.h sys/personality.h utmpx.h])
# Check for some syscalls functions # Check for some syscalls functions
AC_CHECK_FUNCS([setns pivot_root sethostname unshare]) AC_CHECK_FUNCS([setns pivot_root sethostname unshare])
......
...@@ -21,6 +21,10 @@ ...@@ -21,6 +21,10 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include "config.h"
#ifdef HAVE_UTMPX_H
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
...@@ -37,7 +41,10 @@ ...@@ -37,7 +41,10 @@
#include "mainloop.h" #include "mainloop.h"
#include "lxc.h" #include "lxc.h"
#include "log.h" #include "log.h"
#ifndef __USE_GNU
#define __USE_GNU #define __USE_GNU
#endif
#include <utmpx.h> #include <utmpx.h>
#undef __USE_GNU #undef __USE_GNU
...@@ -410,3 +417,5 @@ int lxc_utmp_del_timer(struct lxc_epoll_descr *descr, ...@@ -410,3 +417,5 @@ int lxc_utmp_del_timer(struct lxc_epoll_descr *descr,
else else
return 0; return 0;
} }
#endif
...@@ -21,8 +21,17 @@ ...@@ -21,8 +21,17 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include "config.h"
struct lxc_handler; struct lxc_handler;
struct lxc_epoll_descr; struct lxc_epoll_descr;
#ifdef HAVE_UTMPX_H
int lxc_utmp_mainloop_add(struct lxc_epoll_descr *descr, int lxc_utmp_mainloop_add(struct lxc_epoll_descr *descr,
struct lxc_handler *handler); struct lxc_handler *handler);
#else
static inline int lxc_utmp_mainloop_add(struct lxc_epoll_descr *descr,
struct lxc_handler *handler) {
return -1;
}
#endif
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