com php-src: leave a sane environment behind (even if empty) when exiting some OS atexit() handlers call getenv(): sapi/cli/ps_title. c

From: Date: Sun, 07 Apr 2013 06:32:20 +0000
Subject: com php-src: leave a sane environment behind (even if empty) when exiting some OS atexit() handlers call getenv(): sapi/cli/ps_title. c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-71876@lists.php.net to get a copy of this message
Commit: 1a71bf646e799851dacb2fbe1a439f21543ca590 Author: Nuno Lopes <nlopess@php.net> Sun, 7 Apr 2013 02:32:20 -0400 Parents: bd96813042c7aecde34e65d0e1f96ce7e8214da7 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1a71bf646e799851dacb2fbe1a439f21543ca590 Log: leave a sane environment behind (even if empty) when exiting some OS atexit() handlers call getenv() Changed paths: M sapi/cli/ps_title.c Diff: diff --git a/sapi/cli/ps_title.c b/sapi/cli/ps_title.c index 8dc4609..6f3bdb8 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 */

« previous php.cvs (#71876) next »