about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
-rw-r--r--autoconf/configure.ac4
-rw-r--r--tools/klee-replay/klee-replay.c10
2 files changed, 11 insertions, 3 deletions
diff --git a/autoconf/configure.ac b/autoconf/configure.ac
index c1b1d2b8..54bc3d32 100644
--- a/autoconf/configure.ac
+++ b/autoconf/configure.ac
@@ -485,8 +485,8 @@ if test "x${have_cap}" = xyes; then
   AC_CHECK_HEADERS([sys/capability.h], [], [have_cap=no])
 fi
 if test "x${have_cap}" = xno; then
-  AC_MSG_ERROR([Library cap and its header file sys/capability.h required for \
-klee-replay. Please install package libcap-dev/libcap-devel.])
+  AC_MSG_WARN([Library cap and its header file sys/capability.h not found, disabling chroot \
+capability checking support for klee-replay.])
 fi
 
 AC_LANG_POP([C])
diff --git a/tools/klee-replay/klee-replay.c b/tools/klee-replay/klee-replay.c
index 0ea88fb1..73e2783e 100644
--- a/tools/klee-replay/klee-replay.c
+++ b/tools/klee-replay/klee-replay.c
@@ -10,6 +10,7 @@
 #include "klee-replay.h"
 
 #include "klee/Internal/ADT/KTest.h"
+#include "klee/Config/config.h"
 
 #include <assert.h>
 #include <stdio.h>
@@ -23,7 +24,10 @@
 #include <unistd.h>
 #include <sys/signal.h>
 #include <sys/wait.h>
+
+#ifdef HAVE_SYS_CAPABILITY_H
 #include <sys/capability.h>
+#endif
 
 static void __emit_error(const char *msg);
 
@@ -221,6 +225,7 @@ static void run_monitored(char *executable, int argc, char **argv) {
   }
 }
 
+#ifdef HAVE_SYS_CAPABILITY_H
 /* ensure this process has CAP_SYS_CHROOT capability. */
 void ensure_capsyschroot(const char *executable) {
   cap_t caps = cap_get_proc();  // all current capabilities.
@@ -237,6 +242,7 @@ void ensure_capsyschroot(const char *executable) {
   }
   cap_free(caps);
 }
+#endif
 
 static void usage(void) {
   fprintf(stderr, "Usage: %s [option]... <executable> <ktest-file>...\n", progname);
@@ -295,9 +301,11 @@ int main(int argc, char** argv) {
 
   char* executable = argv[optind];
 
-  /* make sure this process has the CAP_SYS_CHROOT capability. */
+  /* make sure this process has the CAP_SYS_CHROOT capability, if possible. */
+#ifdef HAVE_SYS_CAPABILITY_H
   if (rootdir)
     ensure_capsyschroot(progname);
+#endif
   
   /* rootdir should be a prefix of executable's path. */
   if (rootdir && strstr(executable, rootdir) != executable) {