projects
/
oweals
/
tinc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b0a8000
)
strndupa() is too arcane for some environments.
author
Guus Sliepen
<guus@tinc-vpn.org>
Fri, 1 Oct 2004 18:24:41 +0000
(18:24 +0000)
committer
Guus Sliepen
<guus@tinc-vpn.org>
Fri, 1 Oct 2004 18:24:41 +0000
(18:24 +0000)
src/process.c
patch
|
blob
|
history
diff --git
a/src/process.c
b/src/process.c
index 7500259f4a295edd1ed3e50aa6498d9eec70370b..9194bedf73cbfd0b8701ee9233078b862c41268f 100644
(file)
--- a/
src/process.c
+++ b/
src/process.c
@@
-362,7
+362,7
@@
bool execute_script(const char *name, char **envp)
#ifdef HAVE_SYSTEM
int status, len;
struct stat s;
- char *scriptname;
+ char *scriptname
, *p
;
int i;
cp();
@@
-400,8
+400,12
@@
bool execute_script(const char *name, char **envp)
for(i = 0; envp[i]; i++) {
char *e = strchr(envp[i], '=');
- if(e)
- putenv(strndupa(envp[i], e - envp[i]));
+ if(e) {
+ p = alloca(e - envp[i] + 1);
+ strncpy(p, envp[i], e - envp[i]);
+ p[e - envp[i]] = '\0';
+ putenv(p);
+ }
}
#ifdef WEXITSTATUS