add debug messages for initialization failures
This commit is contained in:
parent
c2639e0738
commit
49c4d9c9cd
20
lib/easy.c
20
lib/easy.c
@ -227,16 +227,22 @@ CURLcode curl_global_init(long flags)
|
|||||||
Curl_ccalloc = (curl_calloc_callback)calloc;
|
Curl_ccalloc = (curl_calloc_callback)calloc;
|
||||||
|
|
||||||
if (flags & CURL_GLOBAL_SSL)
|
if (flags & CURL_GLOBAL_SSL)
|
||||||
if (!Curl_ssl_init())
|
if (!Curl_ssl_init()) {
|
||||||
|
DEBUGF(fprintf(stderr, "Error: Curl_ssl_init failed\n"));
|
||||||
return CURLE_FAILED_INIT;
|
return CURLE_FAILED_INIT;
|
||||||
|
}
|
||||||
|
|
||||||
if (flags & CURL_GLOBAL_WIN32)
|
if (flags & CURL_GLOBAL_WIN32)
|
||||||
if (win32_init() != CURLE_OK)
|
if (win32_init() != CURLE_OK) {
|
||||||
|
DEBUGF(fprintf(stderr, "Error: win32_init failed\n"));
|
||||||
return CURLE_FAILED_INIT;
|
return CURLE_FAILED_INIT;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef _AMIGASF
|
#ifdef _AMIGASF
|
||||||
if(!amiga_init())
|
if(!amiga_init()) {
|
||||||
|
DEBUGF(fprintf(stderr, "Error: amiga_init failed\n"));
|
||||||
return CURLE_FAILED_INIT;
|
return CURLE_FAILED_INIT;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_LIBIDN
|
#ifdef USE_LIBIDN
|
||||||
@ -318,15 +324,19 @@ CURL *curl_easy_init(void)
|
|||||||
/* Make sure we inited the global SSL stuff */
|
/* Make sure we inited the global SSL stuff */
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
res = curl_global_init(CURL_GLOBAL_DEFAULT);
|
res = curl_global_init(CURL_GLOBAL_DEFAULT);
|
||||||
if(res)
|
if(res) {
|
||||||
/* something in the global init failed, return nothing */
|
/* something in the global init failed, return nothing */
|
||||||
|
DEBUGF(fprintf(stderr, "Error: curl_global_init failed\n"));
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We use curl_open() with undefined URL so far */
|
/* We use curl_open() with undefined URL so far */
|
||||||
res = Curl_open(&data);
|
res = Curl_open(&data);
|
||||||
if(res != CURLE_OK)
|
if(res != CURLE_OK) {
|
||||||
|
DEBUGF(fprintf(stderr, "Error: Curl_open failed\n"));
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
@ -485,14 +485,17 @@ CURLcode Curl_open(struct SessionHandle **curl)
|
|||||||
|
|
||||||
/* Very simple start-up: alloc the struct, init it with zeroes and return */
|
/* Very simple start-up: alloc the struct, init it with zeroes and return */
|
||||||
data = (struct SessionHandle *)calloc(1, sizeof(struct SessionHandle));
|
data = (struct SessionHandle *)calloc(1, sizeof(struct SessionHandle));
|
||||||
if(!data)
|
if(!data) {
|
||||||
/* this is a very serious error */
|
/* this is a very serious error */
|
||||||
|
DEBUGF(fprintf(stderr, "Error: calloc of SessionHandle failed\n"));
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
data->magic = CURLEASY_MAGIC_NUMBER;
|
data->magic = CURLEASY_MAGIC_NUMBER;
|
||||||
|
|
||||||
#ifdef USE_ARES
|
#ifdef USE_ARES
|
||||||
if(ARES_SUCCESS != ares_init(&data->state.areschannel)) {
|
if(ARES_SUCCESS != ares_init(&data->state.areschannel)) {
|
||||||
|
DEBUGF(fprintf(stderr, "Error: ares_init failed\n"));
|
||||||
free(data);
|
free(data);
|
||||||
return CURLE_FAILED_INIT;
|
return CURLE_FAILED_INIT;
|
||||||
}
|
}
|
||||||
@ -503,8 +506,10 @@ CURLcode Curl_open(struct SessionHandle **curl)
|
|||||||
/* We do some initial setup here, all those fields that can't be just 0 */
|
/* We do some initial setup here, all those fields that can't be just 0 */
|
||||||
|
|
||||||
data->state.headerbuff=(char*)malloc(HEADERSIZE);
|
data->state.headerbuff=(char*)malloc(HEADERSIZE);
|
||||||
if(!data->state.headerbuff)
|
if(!data->state.headerbuff) {
|
||||||
|
DEBUGF(fprintf(stderr, "Error: malloc of headerbuff failed\n"));
|
||||||
res = CURLE_OUT_OF_MEMORY;
|
res = CURLE_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
data->state.headersize=HEADERSIZE;
|
data->state.headersize=HEADERSIZE;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user