1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

Fixed a few compiler warnings. Try to do a slightly better job of

cleaning up after an OOM condition in curl_multi_add_handle
This commit is contained in:
Dan Fandrich 2007-08-30 18:26:19 +00:00
parent da4a776758
commit 5d4c981e13
2 changed files with 8 additions and 6 deletions

View File

@ -511,7 +511,7 @@ CURLMcode curl_multi_add_handle(CURLM *multi_handle,
/* We want the connection cache to have plenty room. Before we supported /* We want the connection cache to have plenty room. Before we supported
the shared cache every single easy handle had 5 entries in their cache the shared cache every single easy handle had 5 entries in their cache
by default. */ by default. */
int newmax = multi->num_easy * 4; long newmax = multi->num_easy * 4;
if(multi->maxconnects && (multi->maxconnects < newmax)) if(multi->maxconnects && (multi->maxconnects < newmax))
/* don't grow beyond the allowed size */ /* don't grow beyond the allowed size */
@ -520,9 +520,11 @@ CURLMcode curl_multi_add_handle(CURLM *multi_handle,
if(newmax > multi->connc->num) { if(newmax > multi->connc->num) {
/* we only do this is we can in fact grow the cache */ /* we only do this is we can in fact grow the cache */
CURLcode res = Curl_ch_connc(easy_handle, multi->connc, newmax); CURLcode res = Curl_ch_connc(easy_handle, multi->connc, newmax);
if(res != CURLE_OK) if(res != CURLE_OK) {
/* TODO: we need to do some cleaning up here! */ /* FIXME: may need to do more cleanup here */
return CURLM_OUT_OF_MEMORY; curl_multi_remove_handle(multi_handle, easy_handle);
return res;
}
} }
} }

View File

@ -320,8 +320,8 @@ static int juggle(curl_socket_t *sockfdp,
nread_stdin = 0; nread_stdin = 0;
do { do {
/* get data in the buffer at the correct position */ /* get data in the buffer at the correct position */
ssize_t rc = read(fileno(stdin), &buffer[nread_stdin], rc = read(fileno(stdin), &buffer[nread_stdin],
buffer_len - nread_stdin); buffer_len - nread_stdin);
logmsg("read %d bytes", rc); logmsg("read %d bytes", rc);
if(rc <= 0) if(rc <= 0)
return FALSE; return FALSE;