summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2012-02-20 12:53:41 -0500
committerColin Walters <walters@verbum.org>2012-02-20 12:53:41 -0500
commitd7d79c6bdb30f391b8d42a90dbef7623a34313b7 (patch)
tree44f4add7dbb5c9a4e2a7f48fc891256124daf821
parent56c31509100e6d98f00186fba75ff7780c1a3d5e (diff)
downloadlinux-user-chroot-d7d79c6bdb30f391b8d42a90dbef7623a34313b7.tar.gz
build: Allow being built if linux/securebits.h isn't available
For some reason the RHEL6 kernel-headers package doesn't have it. Let's just follow for now the cargo culting of "define defines ourself if not available" that various kernel-tied utilities have because various buildsystems are too shitty to make it easy to install newer kernel headers even if you're running an old kernel.
-rw-r--r--configure.ac4
-rw-r--r--src/linux-user-chroot.c7
2 files changed, 10 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 2f840f0..223871f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,6 +22,10 @@ AC_SUBST(WARN_CFLAGS)
LT_PREREQ([2.2.4])
LT_INIT([disable-static])
+AC_CHECK_HEADER([linux/securebits.h],
+ [AC_DEFINE([HAVE_LINUX_SECUREBITS_H], [1],
+ [Define to 1 if we have securebits.h])])
+
AC_PATH_PROG([XSLTPROC], [xsltproc])
AM_CONDITIONAL(HAVE_XSLTPROC, test x"$XSLTPROC" != x)
diff --git a/src/linux-user-chroot.c b/src/linux-user-chroot.c
index 0cd74f8..66285e5 100644
--- a/src/linux-user-chroot.c
+++ b/src/linux-user-chroot.c
@@ -37,8 +37,13 @@
#include <sys/mount.h>
#include <sys/syscall.h>
#include <sys/wait.h>
-#include <linux/securebits.h>
#include <sched.h>
+#ifdef HAVE_LINUX_SECUREBITS_H
+#include <linux/securebits.h>
+#else
+#define SECBIT_NOROOT (1 << 0)
+#define SECBIT_NOROOT_LOCKED (1 << 1)
+#endif
static void fatal (const char *message, ...) __attribute__ ((noreturn)) __attribute__ ((format (printf, 1, 2)));
static void fatal_errno (const char *message) __attribute__ ((noreturn));