diff options
author | Nuno Lopes <nlopess@php.net> | 2013-04-07 02:32:20 -0400 |
---|---|---|
committer | Nuno Lopes <nlopess@php.net> | 2013-04-07 02:33:33 -0400 |
commit | e769025791e1696dcb6bc09c9b066844df4ce763 (patch) | |
tree | abba74ae45a851be4c0438cb094f688ee9d289b6 /sapi | |
parent | 5ac8084e5f339132e7aa94b83bddfcd16641e9be (diff) | |
download | php-git-e769025791e1696dcb6bc09c9b066844df4ce763.tar.gz |
leave a sane environment behind (even if empty) when exiting
some OS atexit() handlers call getenv()
Diffstat (limited to 'sapi')
-rw-r--r-- | sapi/cli/ps_title.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sapi/cli/ps_title.c b/sapi/cli/ps_title.c index 8dc46094dd..6f3bdb862d 100644 --- a/sapi/cli/ps_title.c +++ b/sapi/cli/ps_title.c @@ -112,6 +112,7 @@ static const size_t ps_buffer_size = MAX_PATH; #elif defined(PS_USE_CLOBBER_ARGV) static char *ps_buffer; /* will point to argv area */ static size_t ps_buffer_size; /* space determined at run time */ +static char *empty_environ[] = {0}; /* empty environment */ #else #define PS_BUFFER_SIZE 256 static char ps_buffer[PS_BUFFER_SIZE]; @@ -415,6 +416,9 @@ void cleanup_ps_args(char **argv) free(frozen_environ[i]); free(frozen_environ); free(new_environ); + /* leave a sane environment behind since some atexit() handlers + call getenv(). */ + environ = empty_environ; } #endif /* PS_USE_CLOBBER_ARGV */ |