From fdd72db7512ecd2410e9ddcb144abea23d67b2c7 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 16 Sep 2016 16:44:50 +0300 Subject: Audit all print_process()/process ctor for path_search() --- bpkg/fetch.cxx | 48 ++++++++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 18 deletions(-) (limited to 'bpkg/fetch.cxx') diff --git a/bpkg/fetch.cxx b/bpkg/fetch.cxx index 33753fb..0851950 100644 --- a/bpkg/fetch.cxx +++ b/bpkg/fetch.cxx @@ -36,12 +36,14 @@ namespace bpkg // const char* args[] = {prog.string ().c_str (), "--version", nullptr}; - if (verb >= 3) - print_process (args); - try { - process pr (args, 0, -1); // Redirect STDOUT to a pipe. + process_path pp (process::path_search (args[0])); + + if (verb >= 3) + print_process (args); + + process pr (pp, args, 0, -1); // Redirect STDOUT to a pipe. string l; @@ -155,6 +157,8 @@ namespace bpkg args.push_back (url.c_str ()); args.push_back (nullptr); + process_path pp (process::path_search (args[0])); + if (verb >= 2) print_process (args); @@ -164,8 +168,8 @@ namespace bpkg // report. Process exceptions must be handled by the caller. // return fo - ? process (out.directory ().string ().c_str (), args.data ()) - : process (args.data (), 0, -1); + ? process (out.directory ().string ().c_str (), pp, args.data ()) + : process (pp, args.data (), 0, -1); } // curl @@ -178,12 +182,14 @@ namespace bpkg // const char* args[] = {prog.string ().c_str (), "--version", nullptr}; - if (verb >= 3) - print_process (args); - try { - process pr (args, 0, -1); // Redirect STDOUT to a pipe. + process_path pp (process::path_search (args[0])); + + if (verb >= 3) + print_process (args); + + process pr (pp, args, 0, -1); // Redirect STDOUT to a pipe. try { @@ -260,6 +266,8 @@ namespace bpkg args.push_back (url.c_str ()); args.push_back (nullptr); + process_path pp (process::path_search (args[0])); + if (verb >= 2) print_process (args); else if (verb == 1 && fo) @@ -273,8 +281,8 @@ namespace bpkg // Process exceptions must be handled by the caller. // return fo - ? process (args.data ()) - : process (args.data (), 0, -1); + ? process (pp, args.data ()) + : process (pp, args.data (), 0, -1); } // fetch @@ -289,12 +297,14 @@ namespace bpkg // const char* args[] = {prog.string ().c_str (), nullptr}; - if (verb >= 3) - print_process (args); - try { - process pr (args, 0, -1, 1); // Redirect STDOUT and STDERR to a pipe. + process_path pp (process::path_search (args[0])); + + if (verb >= 3) + print_process (args); + + process pr (pp, args, 0, -1, 1); // Redirect STDOUT and STDERR to a pipe. try { @@ -363,6 +373,8 @@ namespace bpkg args.push_back (url.c_str ()); args.push_back (nullptr); + process_path pp (process::path_search (args[0])); + if (verb >= 2) print_process (args); @@ -372,8 +384,8 @@ namespace bpkg // report. Process exceptions must be handled by the caller. // return fo - ? process (out.directory ().string ().c_str (), args.data ()) - : process (args.data (), 0, -1); + ? process (out.directory ().string ().c_str (), pp, args.data ()) + : process (pp, args.data (), 0, -1); } // The dispatcher. -- cgit v1.1