diff options
author | Daniel Stenberg <daniel@haxx.se> | 2000-05-29 23:07:22 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2000-05-29 23:07:22 +0000 |
commit | 6d522c9c1dae070f73aae1022b09b68f9153959e (patch) | |
tree | e8d3b26169fb00fff416efd01a353a5b079e908a /lib/getenv.c | |
parent | 45885f30c2753c66cff34f2e80ac26dcc8cfae75 (diff) | |
download | curl-6d522c9c1dae070f73aae1022b09b68f9153959e.tar.gz |
made getenv() more threadsafe for win32
Diffstat (limited to 'lib/getenv.c')
-rw-r--r-- | lib/getenv.c | 5 |
1 files changed, 3 insertions, 2 deletions
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 <stdio.h> #include <stdlib.h> +#include <string.h> #ifdef WIN32 #include <windows.h> @@ -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) |