diff options
author | Daniel Dunbar <daniel@zuster.org> | 2014-09-12 13:17:52 -0700 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2014-09-12 17:39:17 -0700 |
commit | e01706cfb754aca4b2c1b2c15428115df46742be (patch) | |
tree | 3afada02ecb349e16e437edc5fc424a5cedc75ed /tools/klee-replay/klee-replay.c | |
parent | 74088fe829b78b5708975a2e7fbcf23ac3ae4c5e (diff) | |
download | klee-e01706cfb754aca4b2c1b2c15428115df46742be.tar.gz |
Do not require <sys/capability.h>, which is Linux specific.
Diffstat (limited to 'tools/klee-replay/klee-replay.c')
-rw-r--r-- | tools/klee-replay/klee-replay.c | 10 |
1 files changed, 9 insertions, 1 deletions
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) { |