1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

Don't pull in environ, not always safe. Global variables are bad anyway.

Use execve when explicit environment variables ptr is available. Otherwise
just use execv.

llvm-svn: 28740
This commit is contained in:
Evan Cheng 2006-06-09 20:43:11 +00:00
parent 4a0ceb1e6d
commit cd37f47980

View File

@ -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);