aboutsummaryrefslogtreecommitdiff
path: root/lib/System/Unix/Program.inc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/System/Unix/Program.inc')
-rw-r--r--lib/System/Unix/Program.inc12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/System/Unix/Program.inc b/lib/System/Unix/Program.inc
index 01eefe0d52..86a5431617 100644
--- a/lib/System/Unix/Program.inc
+++ b/lib/System/Unix/Program.inc
@@ -29,8 +29,6 @@
#include <fcntl.h>
#endif
-extern char** environ;
-
namespace llvm {
using namespace sys;
@@ -147,13 +145,11 @@ Program::ExecuteAndWait(const Path& path,
}
}
- // 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);