From d14a492019ac04d3afbb0fb519d16c331dc4e93b Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 10 Jun 2009 15:29:11 +0000 Subject: Fix a infinite loop on error. Thanks to Milo for the pointer. git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@776 7dcaeef0-15fb-0310-b436-a5af3365683c --- libssh/channels.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libssh') diff --git a/libssh/channels.c b/libssh/channels.c index 2b78645f..23f4ceb5 100644 --- a/libssh/channels.c +++ b/libssh/channels.c @@ -904,7 +904,9 @@ int channel_write(CHANNEL *channel, const void *data, u32 len) { /* What happens when the channel window is zero? */ while(channel->remote_window == 0) { /* parse every incoming packet */ - packet_wait(channel->session, 0, 0); + if (packet_wait(channel->session, 0, 0) == SSH_ERROR) { + goto error; + } } effectivelen = len > channel->remote_window ? channel->remote_window : len; } else { -- cgit v1.2.3