aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2008-03-22 22:00:21 +0000
committerDaniel Stenberg <daniel@haxx.se>2008-03-22 22:00:21 +0000
commit95bd901efe8c41bbfe7fa80c1c440c84dfe60fe1 (patch)
tree7ba7fcc9216cc46cff7bfe8971fc3cd13d6f8a1d /lib
parent98c9a5b7f6f60822f5a0dc42d74b747323eb48b3 (diff)
- Fixed the problem with doing a zero byte SCP transfer, verified with test
case 617 (which was added by Daniel Fandrich 5 Mar 2008).
Diffstat (limited to 'lib')
-rw-r--r--lib/transfer.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/lib/transfer.c b/lib/transfer.c
index 9918a015d..0856d2a55 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -397,18 +397,26 @@ CURLcode Curl_readwrite(struct connectdata *conn,
bytestoread = (size_t)totalleft;
}
- /* receive data from the network! */
- readrc = Curl_read(conn, conn->sockfd, k->buf, bytestoread, &nread);
+ if(bytestoread) {
+ /* receive data from the network! */
+ readrc = Curl_read(conn, conn->sockfd, k->buf, bytestoread, &nread);
- /* subzero, this would've blocked */
- if(0 > readrc)
- break; /* get out of loop */
+ /* subzero, this would've blocked */
+ if(0 > readrc)
+ break; /* get out of loop */
- /* get the CURLcode from the int */
- result = (CURLcode)readrc;
+ /* get the CURLcode from the int */
+ result = (CURLcode)readrc;
- if(result>0)
- return result;
+ if(result>0)
+ return result;
+ }
+ else {
+ /* read nothing but since we wanted nothing we consider this an OK
+ situation to proceed from */
+ nread = 0;
+ result = CURLE_OK;
+ }
if((k->bytecount == 0) && (k->writebytecount == 0)) {
Curl_pgrsTime(data, TIMER_STARTTRANSFER);