aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/tools/linux-sandbox-options.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/tools/linux-sandbox-options.cc')
-rw-r--r--src/main/tools/linux-sandbox-options.cc16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/main/tools/linux-sandbox-options.cc b/src/main/tools/linux-sandbox-options.cc
index cbb8ea8d19..0d56f7ce62 100644
--- a/src/main/tools/linux-sandbox-options.cc
+++ b/src/main/tools/linux-sandbox-options.cc
@@ -12,14 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#include "linux-sandbox-options.h"
-#include "linux-sandbox-utils.h"
+#include "src/main/tools/linux-sandbox-options.h"
#define DIE(args...) \
{ \
fprintf(stderr, __FILE__ ":" S__LINE__ ": \"" args); \
fprintf(stderr, "\": "); \
- perror(NULL); \
+ perror(nullptr); \
exit(EXIT_FAILURE); \
}
@@ -39,6 +38,8 @@
#include <string>
#include <vector>
+#include "src/main/tools/linux-sandbox-utils.h"
+
using std::ifstream;
using std::unique_ptr;
using std::vector;
@@ -199,6 +200,7 @@ static void ParseCommandLine(unique_ptr<vector<char *>> args) {
if (optind < static_cast<int>(args->size())) {
if (opt.args.empty()) {
opt.args.assign(args->begin() + optind, args->end());
+ opt.args.push_back(nullptr);
} else {
Usage(args->front(), "Merging commands not supported.");
}
@@ -207,8 +209,8 @@ static void ParseCommandLine(unique_ptr<vector<char *>> args) {
// Expands a single argument, expanding options @filename to read in the content
// of the file and add it to the list of processed arguments.
-unique_ptr<vector<char *>> ExpandArgument(unique_ptr<vector<char *>> expanded,
- char *arg) {
+static unique_ptr<vector<char *>> ExpandArgument(
+ unique_ptr<vector<char *>> expanded, char *arg) {
if (arg[0] == '@') {
const char *filename = arg + 1; // strip off the '@'.
ifstream f(filename);
@@ -236,7 +238,7 @@ unique_ptr<vector<char *>> ExpandArgument(unique_ptr<vector<char *>> expanded,
// Pre-processes an argument list, expanding options @filename to read in the
// content of the file and add it to the list of arguments. Stops expanding
// arguments once it encounters "--".
-unique_ptr<vector<char *>> ExpandArguments(const vector<char *> &args) {
+static unique_ptr<vector<char *>> ExpandArguments(const vector<char *> &args) {
unique_ptr<vector<char *>> expanded(new vector<char *>());
expanded->reserve(args.size());
for (auto arg = args.begin(); arg != args.end(); ++arg) {
@@ -260,6 +262,6 @@ void ParseOptions(int argc, char *argv[]) {
}
if (opt.working_dir.empty()) {
- opt.working_dir = getcwd(NULL, 0);
+ opt.working_dir = getcwd(nullptr, 0);
}
}