[llvm-commits] CVS: llvm/lib/System/Unix/Program.cpp

Reid Spencer reid at x10sys.com
Mon Dec 13 20:19:03 PST 2004



Changes in directory llvm/lib/System/Unix:

Program.cpp updated: 1.6 -> 1.7
---
Log message:

For PR351: http://llvm.cs.uiuc.edu/PR351 :
Implement the new environment pointer for ExecuteAndWait


---
Diffs of the changes:  (+8 -3)

Index: llvm/lib/System/Unix/Program.cpp
diff -u llvm/lib/System/Unix/Program.cpp:1.6 llvm/lib/System/Unix/Program.cpp:1.7
--- llvm/lib/System/Unix/Program.cpp:1.6	Fri Dec 10 18:14:15 2004
+++ llvm/lib/System/Unix/Program.cpp	Mon Dec 13 22:18:51 2004
@@ -79,7 +79,8 @@
 //
 int 
 Program::ExecuteAndWait(const Path& path, 
-                        const std::vector<std::string>& args) {
+                        const std::vector<std::string>& args,
+                        const char ** envp ) {
   if (!path.executable())
     throw path.toString() + " is not executable"; 
 
@@ -103,11 +104,15 @@
       break;
 
     // Child process: Execute the program.
-    case 0:
-      execve (path.c_str(), (char** const)argv, environ);
+    case 0: {
+      char** env = environ;
+      if (envp != 0)
+        env = (char**) envp;
+      execve (path.c_str(), (char** const)argv, env);
       // If the execve() failed, we should exit and let the parent pick up
       // our non-zero exit status.
       exit (errno);
+    }
 
     // Parent process: Break out of the switch to do our processing.
     default:






More information about the llvm-commits mailing list