From: Fredrik Tolf Date: Thu, 5 Nov 2009 15:59:08 +0000 (+0100) Subject: Truncate the calculated transfer curpos when reading local file data. X-Git-Url: http://dolda2000.com/gitweb/?p=doldaconnect.git;a=commitdiff_plain;h=1c5e71ff5eb6058d1729e43cc22167b799c99bed Truncate the calculated transfer curpos when reading local file data. With command-stream text left unsent in the socket pipe, curpos would become negative, which messes things up. --- diff --git a/daemon/transfer.c b/daemon/transfer.c index 62e81d6..1863e74 100644 --- a/daemon/transfer.c +++ b/daemon/transfer.c @@ -142,7 +142,8 @@ static void localread(struct socket *sk, struct transfer *transfer) transfer->localpos += blen; bytesupload += blen; } - curpos = transfer->localpos - socktqueuesize(transfer->datapipe); + if((curpos = transfer->localpos - socktqueuesize(transfer->datapipe)) < 0) + curpos = 0; if(curpos != transfer->curpos) { transfer->curpos = curpos; CBCHAINDOCB(transfer, trans_p, transfer);