projects
/
tinc
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
9e44f11
)
Clean up environment after executing scripts.
author
Guus Sliepen
<guus@tinc-vpn.org>
Mon, 14 Jun 2004 14:32:10 +0000
(14:32 +0000)
committer
Guus Sliepen
<guus@tinc-vpn.org>
Mon, 14 Jun 2004 14:32:10 +0000
(14:32 +0000)
src/process.c
patch
|
blob
|
history
diff --git
a/src/process.c
b/src/process.c
index
c1dd2d0
..
7500259
100644
(file)
--- a/
src/process.c
+++ b/
src/process.c
@@
-363,6
+363,7
@@
bool execute_script(const char *name, char **envp)
int status, len;
struct stat s;
char *scriptname;
int status, len;
struct stat s;
char *scriptname;
+ int i;
cp();
cp();
@@
-386,8
+387,8
@@
bool execute_script(const char *name, char **envp)
#ifdef HAVE_PUTENV
/* Set environment */
#ifdef HAVE_PUTENV
/* Set environment */
-
while(*envp
)
- putenv(
*envp++
);
+
for(i = 0; envp[i]; i++
)
+ putenv(
envp[i]
);
#endif
scriptname[len - 1] = '\"';
#endif
scriptname[len - 1] = '\"';
@@
-395,7
+396,13
@@
bool execute_script(const char *name, char **envp)
free(scriptname);
free(scriptname);
- /* Unset environment? */
+ /* Unset environment */
+
+ for(i = 0; envp[i]; i++) {
+ char *e = strchr(envp[i], '=');
+ if(e)
+ putenv(strndupa(envp[i], e - envp[i]));
+ }
#ifdef WEXITSTATUS
if(status != -1) {
#ifdef WEXITSTATUS
if(status != -1) {