mirror of
https://github.com/moparisthebest/curl
synced 2024-11-11 12:05:06 -05:00
modified to the new curl_getenv() style
This commit is contained in:
parent
6d522c9c1d
commit
15c143bba9
11
src/main.c
11
src/main.c
@ -832,16 +832,21 @@ static int parseconfig(char *filename,
|
|||||||
char configbuffer[4096];
|
char configbuffer[4096];
|
||||||
char filebuffer[256];
|
char filebuffer[256];
|
||||||
bool usedarg;
|
bool usedarg;
|
||||||
|
char *home=NULL;
|
||||||
|
|
||||||
if(!filename || !*filename) {
|
if(!filename || !*filename) {
|
||||||
/* NULL or no file name attempts to load .curlrc from the homedir! */
|
/* NULL or no file name attempts to load .curlrc from the homedir! */
|
||||||
|
|
||||||
#define CURLRC DOT_CHAR "curlrc"
|
#define CURLRC DOT_CHAR "curlrc"
|
||||||
|
|
||||||
char *home = curl_GetEnv("HOME"); /* portable environment reader */
|
home = curl_GetEnv("HOME"); /* portable environment reader */
|
||||||
|
|
||||||
if(!home || (strlen(home)>(sizeof(filebuffer)-strlen(CURLRC))))
|
if(!home)
|
||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
|
if(strlen(home)>(sizeof(filebuffer)-strlen(CURLRC))) {
|
||||||
|
free(home);
|
||||||
|
return CURLE_OK;
|
||||||
|
}
|
||||||
|
|
||||||
sprintf(filebuffer, "%s%s%s", home, DIR_CHAR, CURLRC);
|
sprintf(filebuffer, "%s%s%s", home, DIR_CHAR, CURLRC);
|
||||||
|
|
||||||
@ -909,6 +914,8 @@ static int parseconfig(char *filename,
|
|||||||
if(file != stdin)
|
if(file != stdin)
|
||||||
fclose(file);
|
fclose(file);
|
||||||
}
|
}
|
||||||
|
if(home)
|
||||||
|
free(home);
|
||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user