From 84a73ae8cdbf6e33d1584685f2dc6967a5cdc133 Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Fri, 9 Feb 2018 18:13:02 +0100 Subject: [PATCH] arrange to return an appropriate status instead of -1 when the command is not found --- src/utils/execmd.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/utils/execmd.cpp b/src/utils/execmd.cpp index 4bf34615..7204f5a6 100644 --- a/src/utils/execmd.cpp +++ b/src/utils/execmd.cpp @@ -540,10 +540,10 @@ int ExecCmd::startExec(const string& cmd, const vector& args, // As we are going to use execve, not execvp, do the PATH thing. string exe; if (!which(cmd, exe)) { - LOGERR("ExecCmd::startExec: " << (cmd) << " not found\n"); + LOGERR("ExecCmd::startExec: " << cmd << " not found\n"); free(argv); free(envv); - return -1; + return 127 << 8; } //////////////////////////////// End vfork child prepare section. @@ -765,9 +765,9 @@ private: int ExecCmd::doexec(const string& cmd, const vector& args, const string *input, string *output) { - - if (startExec(cmd, args, input != 0, output != 0) < 0) { - return -1; + int status = startExec(cmd, args, input != 0, output != 0); + if (status) { + return status; } // Cleanup in case we return early