[linux-user-chroot] build: Allow being built if linux/securebits.h isn't available



commit d7d79c6bdb30f391b8d42a90dbef7623a34313b7
Author: Colin Walters <walters verbum org>
Date:   Mon Feb 20 12:53:41 2012 -0500

    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.

 configure.ac            |    4 ++++
 src/linux-user-chroot.c |    7 ++++++-
 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));



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]