]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
liblxc: Handle missing PR_CAPBSET_DROP definition
authorMatt Helsley <matthltc@us.ibm.com>
Sun, 8 Mar 2009 16:09:27 +0000 (17:09 +0100)
committerDaniel Lezcano <dlezcano@fr.ibm.com>
Sun, 8 Mar 2009 16:09:27 +0000 (17:09 +0100)
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 <matthltc@us.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
configure.in
src/lxc/start.c

index 46c01a1006480b4dceded66a0db86b89048e9444..7bc7882575f3c66d818a75bfd9961dfb1e511ca0 100644 (file)
@@ -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 <sys/capability.h>])
 
+# Some systems lack PR_CAPBSET_DROP definition => HAVE_DECL_PR_CAPBSET_DROP
+AC_CHECK_DECLS([PR_CAPBSET_DROP], [], [], [#include <sys/prctl.h>])
+
 AC_CHECK_HEADERS([sys/signalfd.h])
 
 AC_PROG_GCC_TRADITIONAL
index e0c381bc7d614ef6abd6b9f1c8e92de92afd57c5..cb32261003db0ec345284106ac7f7b4b614c06d6 100644 (file)
 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"