summaryrefslogtreecommitdiff
path: root/lib/getenv.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2001-01-24 09:01:32 +0000
committerDaniel Stenberg <daniel@haxx.se>2001-01-24 09:01:32 +0000
commitb3dbdfa3066d1cde4d72579527e2004218d4ec0d (patch)
treeee2e0e43ae1dc5c482f19b700fc67b85f590fede /lib/getenv.c
parent25bad589ba15e83900d074367ade648669377c5e (diff)
downloadcurl-b3dbdfa3066d1cde4d72579527e2004218d4ec0d.tar.gz
Robert Weaver's fix
Diffstat (limited to 'lib/getenv.c')
-rw-r--r--lib/getenv.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/getenv.c b/lib/getenv.c
index 0c23e76aa..941ee8535 100644
--- a/lib/getenv.c
+++ b/lib/getenv.c
@@ -41,12 +41,13 @@ char *GetEnv(char *variable)
char env[MAX_PATH]; /* MAX_PATH is from windef.h */
char *temp = getenv(variable);
env[0] = '\0';
- ExpandEnvironmentStrings(temp, env, sizeof(env));
+ if (temp != NULL)
+ ExpandEnvironmentStrings(temp, env, sizeof(env));
#else
/* no length control */
char *env = getenv(variable);
#endif
- return env?strdup(env):NULL;
+ return (env && env[0])?strdup(env):NULL;
}
char *curl_getenv(char *v)