[llvm-commits] CVS: llvm/lib/System/Unix/Program.inc
Evan Cheng
evan.cheng at apple.com
Fri Jun 9 13:43:23 PDT 2006
Changes in directory llvm/lib/System/Unix:
Program.inc updated: 1.17 -> 1.18
---
Log message:
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.
---
Diffs of the changes: (+4 -8)
Program.inc | 12 ++++--------
1 files changed, 4 insertions(+), 8 deletions(-)
Index: llvm/lib/System/Unix/Program.inc
diff -u llvm/lib/System/Unix/Program.inc:1.17 llvm/lib/System/Unix/Program.inc:1.18
--- llvm/lib/System/Unix/Program.inc:1.17 Wed Jun 7 18:18:33 2006
+++ llvm/lib/System/Unix/Program.inc Fri Jun 9 15:43:11 2006
@@ -29,8 +29,6 @@
#include <fcntl.h>
#endif
-extern char** environ;
-
namespace llvm {
using namespace sys;
@@ -147,13 +145,11 @@
}
}
- // 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);
More information about the llvm-commits
mailing list