diff --git a/lib/procs.cpp b/lib/procs.cpp index 69e38299..eeece6c7 100644 --- a/lib/procs.cpp +++ b/lib/procs.cpp @@ -270,7 +270,7 @@ pid_t Util::Procs::StartPiped(std::deque & argDeq, int * fdin, int /// \arg fdin Standard input file descriptor. If null, /dev/null is assumed. Otherwise, if arg contains -1, a new fd is automatically allocated and written into this arg. Then the arg will be used as fd. /// \arg fdout Same as fdin, but for stdout. /// \arg fdout Same as fdin, but for stderr. -pid_t Util::Procs::StartPiped(char * const * argv, int * fdin, int * fdout, int * fderr) { +pid_t Util::Procs::StartPiped(const char * const * argv, int * fdin, int * fdout, int * fderr) { pid_t pid; int pipein[2], pipeout[2], pipeerr[2]; //DEBUG_MSG(DLVL_DEVEL, "setHandler"); @@ -364,7 +364,8 @@ pid_t Util::Procs::StartPiped(char * const * argv, int * fdin, int * fdout, int if (devnull != -1) { close(devnull); } - execvp(argv[0], argv); + //Because execvp requires a char* const* and we have a const char* const* + execvp(argv[0], (char* const*)argv); DEBUG_MSG(DLVL_ERROR, "execvp failed for process %s, reason: %s", argv[0], strerror(errno)); exit(42); } else if (pid == -1) { diff --git a/lib/procs.h b/lib/procs.h index 667f570b..25d78e5a 100644 --- a/lib/procs.h +++ b/lib/procs.h @@ -30,7 +30,7 @@ namespace Util { static void setHandler(); static std::string getOutputOf(char * const * argv); static std::string getOutputOf(std::deque & argDeq); - static pid_t StartPiped(char * const * argv, int * fdin, int * fdout, int * fderr); + static pid_t StartPiped(const char * const * argv, int * fdin, int * fdout, int * fderr); static pid_t StartPiped(std::deque & argDeq, int * fdin, int * fdout, int * fderr); static void Stop(pid_t name); static void Murder(pid_t name);