From 8e9652cf595aafa4acc7d67de967afdbca71ac75 Mon Sep 17 00:00:00 2001 From: Michael Denkowski Date: Thu, 20 Mar 2014 14:21:17 -0700 Subject: Include full argv (including command) as arg 2 of execvp() --- mteval/external_scorer.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mteval/external_scorer.cc b/mteval/external_scorer.cc index efd880fe..054c279e 100644 --- a/mteval/external_scorer.cc +++ b/mteval/external_scorer.cc @@ -63,10 +63,10 @@ ScoreServer::ScoreServer(const string& cmd) { cerr << "Exec'ing from child " << cmd << endl; vector vargs; SplitOnWhitespace(cmd, &vargs); - const char** cargv = static_cast(malloc(sizeof(const char*) * vargs.size())); - for (unsigned i = 1; i < vargs.size(); ++i) cargv[i-1] = vargs[i].c_str(); - cargv[vargs.size() - 1] = NULL; - execvp(vargs[0].c_str(), (char* const*)cargv); + const char** cargv = static_cast(malloc(sizeof(const char*) * (vargs.size() + 1))); + for (unsigned i = 0; i < vargs.size(); i++) cargv[i] = vargs[i].c_str(); + cargv[vargs.size()] = NULL; + execvp(*cargv, (char* const*)cargv); } else { // parent close(c2p[1]); close(p2c[0]); -- cgit v1.2.3