Subject: Re: [libssh2] SCP upload issues

Re: [libssh2] SCP upload issues

From: Peter Stuge <peter_at_stuge.se>
Date: Tue, 5 Feb 2008 17:49:17 +0100

On Tue, Feb 05, 2008 at 04:54:27PM +0100, Erik Broßler wrote:
> With this patch applied, arbitrary test files could be uploaded
> properly with both, the sample programs and cURL.

Looks good to me, does it apply cleanly also to current svn?
Should I formally ack?

Acked-by: Peter Stuge <peter_at_stuge.se>

> diff -Naur libssh2-0.18-orig/src/channel.c libssh2-0.18/src/channel.c
> --- libssh2-0.18-orig/src/channel.c 2007-11-08 16:11:33.000000000 +0100
> +++ libssh2-0.18/src/channel.c 2008-02-04 20:48:30.000000000 +0100
> @@ -1690,9 +1690,9 @@
> channel->write_state = libssh2_NB_state_allocated;
> }
>
> - while (buflen > 0) {
> + while (buflen > channel->write_bufwrote) {
> if (channel->write_state == libssh2_NB_state_allocated) {
> - channel->write_bufwrite = buflen;
> + channel->write_bufwrite = buflen - channel->write_bufwrote;
> channel->write_s = channel->write_packet;
>
> *(channel->write_s++) =
> @@ -1714,6 +1714,7 @@
> if (rc < 0) {
> /* Error or EAGAIN occurred, disconnect? */
> if (rc != PACKET_EAGAIN) {
> + LIBSSH2_FREE(session, channel->write_packet);
> channel->write_state = libssh2_NB_state_idle;
> }
> return rc;
> @@ -1747,7 +1748,7 @@
> }
> libssh2_htonu32(channel->write_s, channel->write_bufwrite);
> channel->write_s += 4;
> - memcpy(channel->write_s, buf, channel->write_bufwrite);
> + memcpy(channel->write_s, buf + channel->write_bufwrote, channel->write_bufwrite);
> channel->write_s += channel->write_bufwrite;
>
> _libssh2_debug(session, LIBSSH2_DBG_CONN,
> @@ -1774,10 +1775,6 @@
> }
> /* Shrink local window size */
> channel->local.window_size -= channel->write_bufwrite;
> -
> - /* Adjust buf for next iteration */
> - buflen -= channel->write_bufwrite;
> - buf += channel->write_bufwrite;
> channel->write_bufwrote += channel->write_bufwrite;
>
> channel->write_state = libssh2_NB_state_allocated;

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
libssh2-devel mailing list
libssh2-devel_at_lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel
Received on 2008-02-05