mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 19:52:54 +01:00
Fix linux build. posix_spawn doesn't inherit the environment by default.
llvm-svn: 101701
This commit is contained in:
parent
22b58ac393
commit
2b694c49bb
@ -34,6 +34,8 @@
|
|||||||
#include <spawn.h>
|
#include <spawn.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern char **environ;
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
using namespace sys;
|
using namespace sys;
|
||||||
|
|
||||||
@ -126,7 +128,7 @@ static bool RedirectIO(const Path *Path, int FD, std::string* ErrMsg) {
|
|||||||
|
|
||||||
#ifdef HAVE_POSIX_SPAWN
|
#ifdef HAVE_POSIX_SPAWN
|
||||||
static bool RedirectIO_PS(const Path *Path, int FD, std::string *ErrMsg,
|
static bool RedirectIO_PS(const Path *Path, int FD, std::string *ErrMsg,
|
||||||
posix_spawn_file_actions_t &FileActions) {
|
posix_spawn_file_actions_t &FileActions) {
|
||||||
if (Path == 0) // Noop
|
if (Path == 0) // Noop
|
||||||
return false;
|
return false;
|
||||||
std::string File;
|
std::string File;
|
||||||
@ -200,6 +202,7 @@ Program::Execute(const Path &path, const char **args, const char **envp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
pid_t PID;
|
pid_t PID;
|
||||||
|
if (!envp) envp = (const char**)environ;
|
||||||
int Err = posix_spawn(&PID, path.c_str(), &FileActions,
|
int Err = posix_spawn(&PID, path.c_str(), &FileActions,
|
||||||
/*attrp*/0, (char**)args, (char**)envp);
|
/*attrp*/0, (char**)args, (char**)envp);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user