From 6d522c9c1dae070f73aae1022b09b68f9153959e Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 29 May 2000 23:07:22 +0000 Subject: made getenv() more threadsafe for win32 --- lib/getenv.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/getenv.c') diff --git a/lib/getenv.c b/lib/getenv.c index 54b0118b6..ff6f541b6 100644 --- a/lib/getenv.c +++ b/lib/getenv.c @@ -39,6 +39,7 @@ #include #include +#include #ifdef WIN32 #include @@ -48,7 +49,7 @@ char *GetEnv(char *variable) { #ifdef WIN32 /* This shit requires windows.h (HUGE) to be included */ - static char env[MAX_PATH]; /* MAX_PATH is from windef.h */ + char env[MAX_PATH]; /* MAX_PATH is from windef.h */ char *temp = getenv(variable); env[0] = '\0'; ExpandEnvironmentStrings(temp, env, sizeof(env)); @@ -56,7 +57,7 @@ char *GetEnv(char *variable) /* no length control */ char *env = getenv(variable); #endif - return env; + return env?strdup(env):NULL; } char *curl_GetEnv(char *v) -- cgit v1.2.3