1 //===- FuzzerUtilLinux.cpp - Misc utils for Linux. ------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
8 // Misc utils for Linux.
9 //===----------------------------------------------------------------------===//
10 #include "FuzzerDefs.h"
11 #if LIBFUZZER_LINUX || LIBFUZZER_NETBSD || LIBFUZZER_FREEBSD || \
13 #include "FuzzerCommand.h"
16 #include <sys/types.h>
22 int ExecuteCommand(const Command &Cmd) {
23 std::string CmdLine = Cmd.toString();
24 int exit_code = system(CmdLine.c_str());
25 if (WIFEXITED(exit_code))
26 return WEXITSTATUS(exit_code);