cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Curl_read() silently ignores an error during read

From: Kamil Dudka <kdudka_at_redhat.com>
Date: Thu, 18 Mar 2010 00:16:41 +0100

On Wednesday 17 of March 2010 23:45:08 Daniel Stenberg wrote:
> I can't remember doing that intentionally and I can't find any good
> motivation to keep it that way. How about a patch similar to this:
>
> --- lib/sendf.c 4 Feb 2010 19:44:31 -0000 1.163
> +++ lib/sendf.c 17 Mar 2010 22:43:07 -0000
> @@ -538,9 +538,10 @@ int Curl_read(struct connectdata *conn,
> if(conn->ssl[num].state == ssl_connection_complete) {
> nread = Curl_ssl_recv(conn, num, buffertofill, bytesfromsocket);
>
> - if(nread == -1) {
> + if(nread == -1)
> return -1; /* -1 from Curl_ssl_recv() means EWOULDBLOCK */
> - }
> + else if(!nread)
> + return CURLE_RECV_ERROR;
> }
> else if(Curl_ssh_enabled(conn, (PROT_SCP|PROT_SFTP))) {
> if(conn->protocol & PROT_SCP)

Looks good to me. Thank you for looking into this!

Kamil
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-03-18