[llvm-commits] [llvm] r101701 - /llvm/trunk/lib/System/Unix/Program.inc

Nick Lewycky nicholas at mxc.ca
Sat Apr 17 23:22:26 PDT 2010


Author: nicholas
Date: Sun Apr 18 01:22:26 2010
New Revision: 101701

URL: http://llvm.org/viewvc/llvm-project?rev=101701&view=rev
Log:
Fix linux build. posix_spawn doesn't inherit the environment by default.

Modified:
    llvm/trunk/lib/System/Unix/Program.inc

Modified: llvm/trunk/lib/System/Unix/Program.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Program.inc?rev=101701&r1=101700&r2=101701&view=diff
==============================================================================
--- llvm/trunk/lib/System/Unix/Program.inc (original)
+++ llvm/trunk/lib/System/Unix/Program.inc Sun Apr 18 01:22:26 2010
@@ -34,6 +34,8 @@
 #include <spawn.h>
 #endif
 
+extern char **environ;
+
 namespace llvm {
 using namespace sys;
 
@@ -126,7 +128,7 @@
 
 #ifdef HAVE_POSIX_SPAWN
 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
     return false;
   std::string File;
@@ -200,6 +202,7 @@
     }
 
     pid_t PID;
+    if (!envp) envp = (const char**)environ;
     int Err = posix_spawn(&PID, path.c_str(), &FileActions,
                           /*attrp*/0, (char**)args, (char**)envp);
                           





More information about the llvm-commits mailing list