diff options
author | Sebastian Hahn <sebastian@torproject.org> | 2012-02-14 12:21:03 +0100 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-02-14 11:18:39 -0500 |
commit | efb7b9dec135594718b765234bc1f745855f60d2 (patch) | |
tree | cf8b42d4c5c221354e0b1bf97a7a6ef8e9f42056 /src/or/transports.c | |
parent | efcdc930fb02d471ef1a5f4c09a30ea512ca5a8b (diff) | |
download | tor-efb7b9dec135594718b765234bc1f745855f60d2.tar.gz tor-efb7b9dec135594718b765234bc1f745855f60d2.zip |
Use _NSGetEnviron() instead of environ where required
OS X would otherwise crash with a segfault when linked statically to
some libraries.
Diffstat (limited to 'src/or/transports.c')
-rw-r--r-- | src/or/transports.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/or/transports.c b/src/or/transports.c index d279d7ad11..6d9b352b2a 100644 --- a/src/or/transports.c +++ b/src/or/transports.c @@ -1076,8 +1076,6 @@ set_managed_proxy_environment(LPVOID *envp, const managed_proxy_t *mp) #else /* _WIN32 */ -extern char **environ; - /** Prepare the environment <b>envp</b> of managed proxy <b>mp</b>. * <b>envp</b> is allocated on the heap and should be freed by the * caller after its use. */ @@ -1090,7 +1088,8 @@ set_managed_proxy_environment(char ***envp, const managed_proxy_t *mp) char *transports_to_launch=NULL; char *bindaddr=NULL; int environ_size=0; - char **environ_tmp = environ; + char **environ_tmp = get_environment(); + char **environ_save = environ_tmp; int n_envs = mp->is_server ? ENVIRON_SIZE_SERVER : ENVIRON_SIZE_CLIENT; @@ -1098,7 +1097,7 @@ set_managed_proxy_environment(char ***envp, const managed_proxy_t *mp) environ_size++; environ_tmp++; } - environ_tmp = environ; + environ_tmp = environ_save; /* allocate enough space for our env. vars and a NULL pointer */ *envp = tor_malloc(sizeof(char*)*(environ_size+n_envs+1)); |