diff options
author | Daniel Stenberg <daniel@haxx.se> | 2010-06-19 00:18:14 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2010-06-19 00:18:14 +0200 |
commit | 1b15b31c8631a4a271f15c4261331dcebec9ba47 (patch) | |
tree | fe80459c08d08a23ca6bcef0c2238016ecf95910 /lib | |
parent | e6d85923c1e9d4a9b76b67a4b31f0815e051b071 (diff) |
sendrecv: treat all negative values from send/recv as errors
For example the libssh2 based functions return other negative
values than -1 to signal errors and it is important that we catch
them properly. Right before this, various failures from libssh2
were treated as negative download amounts which caused havoc.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sendf.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/sendf.c b/lib/sendf.c index 94bcb9c78..b73c22438 100644 --- a/lib/sendf.c +++ b/lib/sendf.c @@ -254,8 +254,8 @@ CURLcode Curl_write(struct connectdata *conn, bytes_written = conn->send[num](conn, num, mem, len, &curlcode); *written = bytes_written; - if(-1 != bytes_written) - /* we completely ignore the curlcode value when -1 is not returned */ + if(bytes_written >= 0) + /* we completely ignore the curlcode value when subzero is not returned */ return CURLE_OK; /* handle CURLE_AGAIN or a send failure */ @@ -577,7 +577,7 @@ CURLcode Curl_read(struct connectdata *conn, /* connection data */ } nread = conn->recv[num](conn, num, buffertofill, bytesfromsocket, &curlcode); - if(nread == -1) + if(nread < 0) return curlcode; if(pipelining) { |