Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meissner <gnu@the-meissners.org>2000-11-22 21:26:10 +0300
committerMichael Meissner <gnu@the-meissners.org>2000-11-22 21:26:10 +0300
commit73dea7905cb5fea2540256bacdfde33fe0ad1a0b (patch)
tree1dd1d4630bf2e207f204657c23319050dbf67c9c /newlib/libc/posix/execl.c
parent0217c5bb3b85854cea392d7299706348dc007ae8 (diff)
Only reference environ indirectly through a pointer
Diffstat (limited to 'newlib/libc/posix/execl.c')
-rw-r--r--newlib/libc/posix/execl.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/newlib/libc/posix/execl.c b/newlib/libc/posix/execl.c
index 075df8eba..098005666 100644
--- a/newlib/libc/posix/execl.c
+++ b/newlib/libc/posix/execl.c
@@ -6,6 +6,11 @@
#include <_ansi.h>
#include <unistd.h>
+/* Only deal with a pointer to environ, to work around subtle bugs with shared
+ libraries and/or small data systems where the user declares his own
+ 'environ'. */
+static char ***p_environ = &environ;
+
#ifdef _HAVE_STDC
#include <stdarg.h>
@@ -38,5 +43,5 @@ execl (path, arg0, va_alist)
while (argv[i++] != NULL);
va_end (args);
- return _execve (path, (char * _CONST *) argv, environ);
+ return _execve (path, (char * _CONST *) argv, *p_environ);
}