diff options
author | Bruce Guenter <bruce@untroubled.org> | 2016-01-18 12:04:41 -0600 |
---|---|---|
committer | Bruce Guenter <bruce@untroubled.org> | 2016-01-19 09:26:56 -0600 |
commit | b83af86a6fe9f308e51ed9528df700acce1626fd (patch) | |
tree | 3c4f4a8dd90206b0f3c50fc4f492cc9089a20063 /src/sendmail.cc | |
parent | 84e4916f1a3fed45ac55611b342f661e9b0c7644 (diff) |
lib: Add program_path function for calculating program names
Diffstat (limited to 'src/sendmail.cc')
-rw-r--r-- | src/sendmail.cc | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/sendmail.cc b/src/sendmail.cc index 7713d3f..38a5826 100644 --- a/src/sendmail.cc +++ b/src/sendmail.cc @@ -25,6 +25,7 @@ #include <unistd.h> #include "fdbuf/fdbuf.h" #include "defines.h" +#include "forkexec.h" #include "setenv.h" #include "cli++/cli++.h" @@ -100,13 +101,10 @@ bool setenvelope(char* str) int do_exec(const char* program, const char* xarg1, int argc, char* argv[]) { - if(chdir(BIN_DIR) == -1) { - ferr << "sendmail: Could not change directory to " << BIN_DIR << endl; - return 1; - } + mystring path = program_path(BIN_DIR, program, NULL); const char* newargv[argc+3]; - newargv[0] = program; + newargv[0] = path.c_str(); int j = 1; if (xarg1) newargv[j++] = xarg1; |