summaryrefslogtreecommitdiff
path: root/sapi/cli/ps_title.c
diff options
context:
space:
mode:
authorNuno Lopes <nlopess@php.net>2013-04-07 02:32:20 -0400
committerNuno Lopes <nlopess@php.net>2013-04-07 02:32:20 -0400
commit1a71bf646e799851dacb2fbe1a439f21543ca590 (patch)
treeac258d235b6ffdf944a81a63a7878204193aa761 /sapi/cli/ps_title.c
parentbd96813042c7aecde34e65d0e1f96ce7e8214da7 (diff)
downloadphp-git-1a71bf646e799851dacb2fbe1a439f21543ca590.tar.gz
leave a sane environment behind (even if empty) when exiting
some OS atexit() handlers call getenv()
Diffstat (limited to 'sapi/cli/ps_title.c')
-rw-r--r--sapi/cli/ps_title.c4
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 */