made getenv() more threadsafe for win32

This commit is contained in:
Daniel Stenberg
2000-05-29 23:07:22 +00:00
parent 45885f30c2
commit 6d522c9c1d
5 changed files with 37 additions and 15 deletions

View File

@@ -95,9 +95,14 @@ int ParseNetrc(char *host,
#define NETRC DOT_CHAR "netrc"
if(!home || (strlen(home)>(sizeof(netrcbuffer)-strlen(NETRC))))
if(!home)
return -1;
if(strlen(home)>(sizeof(netrcbuffer)-strlen(NETRC))) {
free(home);
return -1;
}
sprintf(netrcbuffer, "%s%s%s", home, DIR_CHAR, NETRC);
file = fopen(netrcbuffer, "r");
@@ -162,6 +167,8 @@ int ParseNetrc(char *host,
fclose(file);
}
free(home);
return retcode;
}