Subject: RE: libssh2_channel_write_ex may incorrectly return EAGAIN

RE: libssh2_channel_write_ex may incorrectly return EAGAIN

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sat, 13 Nov 2010 22:06:04 +0100 (CET)

On Sat, 13 Nov 2010, Mark Riordan wrote:

> My program now terminates with an access violation (segfault to you UNIX
> types) after a few writes. Access vios occur at various places:

Thanks for your patience and I'm sorry we go this back and forth between all
sorts of weird bugs and errors, but I do believe we will end up with a better
design and better code in the end.

> [libssh2] 0.848116 Conn: Writing -4029 bytes on channel 0/0, stream #0

I think this is the key to the problems and I also think I know why this
happens.

_libssh2_channel_write() can now (since my bug fix from a few hours ago)
return more data than what is passed in to it (if a previous call got EAGAIN)
and when it does that, it may confuse the caller greatly and might trigger a
counter wrap into negative.

Tricky.

-- 
  / daniel.haxx.se
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-11-13