From 04304d129bbc6a63a7ff2051003e40ec9edbcb0f Mon Sep 17 00:00:00 2001 From: Matt Morehouse Date: Mon, 4 Dec 2017 19:25:59 +0000 Subject: [libFuzzer] Encapsulate commands in a class. Summary: To be more portable (especially w.r.t. platforms without system()), commands should be managed programmatically rather than via string manipulation on the command line. This change introduces Fuzzer::Command, with methods to manage arguments and flags, set output options, and execute the command. Patch By: aarongreen Reviewers: kcc, morehouse Reviewed By: kcc, morehouse Subscribers: llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D40103 llvm-svn: 319680 --- compiler-rt/lib/fuzzer/FuzzerUtilLinux.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (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 69d46b578c0..c7cf2c0a778 100644 --- a/compiler-rt/lib/fuzzer/FuzzerUtilLinux.cpp +++ b/compiler-rt/lib/fuzzer/FuzzerUtilLinux.cpp @@ -10,13 +10,15 @@ //===----------------------------------------------------------------------===// #include "FuzzerDefs.h" #if LIBFUZZER_LINUX || LIBFUZZER_NETBSD +#include "FuzzerCommand.h" #include namespace fuzzer { -int ExecuteCommand(const std::string &Command) { - return system(Command.c_str()); +int ExecuteCommand(const Command &Cmd) { + std::string CmdLine = Cmd.toString(); + return system(CmdLine.c_str()); } } // namespace fuzzer -- cgit v1.2.3