From e01706cfb754aca4b2c1b2c15428115df46742be Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Fri, 12 Sep 2014 13:17:52 -0700 Subject: Do not require , which is Linux specific. --- autoconf/configure.ac | 4 ++-- tools/klee-replay/klee-replay.c | 10 +++++++++- 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 #include @@ -23,7 +24,10 @@ #include #include #include + +#ifdef HAVE_SYS_CAPABILITY_H #include +#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]... ...\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) { -- cgit 1.4.1