From: Matt Helsley Date: Sun, 8 Mar 2009 16:09:27 +0000 (+0100) Subject: liblxc: Handle missing PR_CAPBSET_DROP definition X-Git-Tag: lxc_0_6_1~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=656994bbfabe378c8e9e5b40ce93eac074a0f7e4;p=thirdparty%2Flxc.git liblxc: Handle missing PR_CAPBSET_DROP definition On distros with older headers liblxc fails to build because PR_CAPBSET_DROP is not defined by including /usr/include/sys/prctl.h. This adds an autoconf test and, if not present, defines it. When prctl() is called on systems that do not support PR_CAPBSET_DROP we should expect EINVAL. This case is already handled by the liblxc code so no further changes are needed. Signed-off-by: Matt Helsley Signed-off-by: Daniel Lezcano --- diff --git a/configure.in b/configure.in index 46c01a100..7bc788257 100644 --- a/configure.in +++ b/configure.in @@ -27,6 +27,9 @@ AC_CHECK_HEADERS([linux/netlink.h linux/genetlink.h], [], AC_MSG_ERROR([netlink AC_CHECK_HEADERS([sys/capability.h], [], AC_MSG_ERROR([please install libcap-devel.]), [#include ]) +# Some systems lack PR_CAPBSET_DROP definition => HAVE_DECL_PR_CAPBSET_DROP +AC_CHECK_DECLS([PR_CAPBSET_DROP], [], [], [#include ]) + AC_CHECK_HEADERS([sys/signalfd.h]) AC_PROG_GCC_TRADITIONAL diff --git a/src/lxc/start.c b/src/lxc/start.c index e0c381bc7..cb3226100 100644 --- a/src/lxc/start.c +++ b/src/lxc/start.c @@ -48,6 +48,10 @@ extern int signalfd (int fd, const sigset_t *mask, int flags); #endif +#if !HAVE_DECL_PR_CAPBSET_DROP +#define PR_CAPBSET_DROP 24 +#endif + #include "error.h" #include "af_unix.h" #include "mainloop.h"