From 63f48717b58d76523fdbfdba6fa1e2c10ae9e3da Mon Sep 17 00:00:00 2001 From: Kostya Serebryany Date: Tue, 12 Feb 2019 00:12:33 +0000 Subject: [libFuzzer] extend the -fork=1 functionality. Still not fully usable, but good enough for the first unit test llvm-svn: 353775 --- compiler-rt/lib/fuzzer/FuzzerUtilLinux.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'compiler-rt/lib/fuzzer/FuzzerUtilLinux.cpp') 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 +#include +#include + 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 -- cgit v1.2.3