diff options
author | Kostya Serebryany <kcc@google.com> | 2019-02-12 00:12:33 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2019-02-12 00:12:33 +0000 |
commit | 63f48717b58d76523fdbfdba6fa1e2c10ae9e3da (patch) | |
tree | 4d83c194d8dd5d507aac81d062664802b4df0929 /compiler-rt/lib/fuzzer/FuzzerUtilLinux.cpp | |
parent | 9ebc9dbd3c7d8ce5fb35d3d166279b39808dac0b (diff) | |
download | bcm5719-llvm-63f48717b58d76523fdbfdba6fa1e2c10ae9e3da.tar.gz bcm5719-llvm-63f48717b58d76523fdbfdba6fa1e2c10ae9e3da.zip |
[libFuzzer] extend the -fork=1 functionality. Still not fully usable, but good enough for the first unit test
llvm-svn: 353775
Diffstat (limited to 'compiler-rt/lib/fuzzer/FuzzerUtilLinux.cpp')
-rw-r--r-- | compiler-rt/lib/fuzzer/FuzzerUtilLinux.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler-rt/lib/fuzzer/FuzzerUtilLinux.cpp b/compiler-rt/lib/fuzzer/FuzzerUtilLinux.cpp index 640f3d9c5d1..d5a15d19f2a 100644 --- a/compiler-rt/lib/fuzzer/FuzzerUtilLinux.cpp +++ b/compiler-rt/lib/fuzzer/FuzzerUtilLinux.cpp @@ -13,12 +13,18 @@ #include "FuzzerCommand.h" #include <stdlib.h> +#include <sys/types.h> +#include <sys/wait.h> + namespace fuzzer { int ExecuteCommand(const Command &Cmd) { std::string CmdLine = Cmd.toString(); - return system(CmdLine.c_str()); + int exit_code = system(CmdLine.c_str()); + if (WIFEXITED(exit_code)) + return WEXITSTATUS(exit_code); + return exit_code; } } // namespace fuzzer |