From 524c868107e561aa47ac209f5a81b4313ab77e66 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Wed, 18 Jan 2017 21:12:28 -0800 Subject: [PATCH] Don't pass empty arguments to ninja Passing an empty argument in argv to ninja results in an error: ninja: error: empty path Don't add jarg to the argument list if it is empty. Bug: 34392351 Test: m -j Change-Id: I39c8998c79b09835650628e1413ae7625cdbc555 --- tools/makeparallel/makeparallel.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/makeparallel/makeparallel.cpp b/tools/makeparallel/makeparallel.cpp index b90668186..0e1e45c15 100644 --- a/tools/makeparallel/makeparallel.cpp +++ b/tools/makeparallel/makeparallel.cpp @@ -338,13 +338,17 @@ int main(int argc, char* argv[]) { // ninja is parallel by default, pass -j1 to disable parallelism if make wasn't parallel args.push_back(strdup("-j1")); } else { - args.push_back(strdup(jarg.c_str())); + if (jarg != "") { + args.push_back(strdup(jarg.c_str())); + } } if (keep_going) { args.push_back(strdup("-k0")); } } else { - args.push_back(strdup(jarg.c_str())); + if (jarg != "") { + args.push_back(strdup(jarg.c_str())); + } } args.insert(args.end(), &argv[2], &argv[argc]);