On 9 February 2012 12:27, Peter Stuge <pe...@stuge.se> wrote: > Alexander Lamaison wrote: >> >> @@ -1348,13 +1334,13 @@ static ssize_t sftp_read(LIBSSH2_SFTP_HANDLE * >> >> handle, char *buffer, >> >> filep->offset_sent -= (chunk->len - rc32); >> >> } >> >> >> >> - if(total_read + rc32 > buffer_size) { >> >> + if(rc32 > buffer_size) { >> >> /* figure out the overlap amount */ >> >> - filep->data_left = (total_read + rc32) - buffer_size; >> >> + filep->data_left = rc32 - buffer_size; >> > >> > Doesn't this lose the bytes that we received from transport but which >> > do not fit into the buffer given to us by the user? >> >> Not unless it did so before. > > Sure. Look at the logic. data_left is being set to a smaller number > of bytes than actually received from transport. Where do the > remaining bytes go?
Right. That's its purpose, isn't it? It stores how big the leftovers are. Why would that be >= the number of bytes received from the transport? Alex _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel