Use execve when explicit environment variables ptr is available. Otherwise
just use execv.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28740
91177308-0d34-0410-b5e6-
96231b3b80d8
#include <fcntl.h>
#endif
-extern char** environ;
-
namespace llvm {
using namespace sys;
}
}
- // Set up the environment
- char** env = environ;
- if (envp != 0)
- env = (char**) envp;
-
// Execute!
- execve (path.c_str(), (char** const)args, env);
+ if (envp != 0)
+ execve (path.c_str(), (char** const)args, (char**)envp);
+ else
+ execv (path.c_str(), (char** const)args);
// If the execve() failed, we should exit and let the parent pick up
// our non-zero exit status.
exit (errno);