aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2005-10-26 19:13:57 +0000
committerAris Adamantiadis <aris@0xbadc0de.be>2005-10-26 19:13:57 +0000
commit7b416e5c520c4dea21e242733d64672f304fdbd3 (patch)
tree1322367d187ac4521e45e6c8e7358e2245b2e02b
parentc53b6b907ce7ccaf720777c18eed3eea46807bb7 (diff)
downloadlibssh-7b416e5c520c4dea21e242733d64672f304fdbd3.tar.gz
libssh-7b416e5c520c4dea21e242733d64672f304fdbd3.tar.xz
libssh-7b416e5c520c4dea21e242733d64672f304fdbd3.zip
resolved the channel hangs on exit issue (moved EOF to read events and removed it from exceptions).
resolved stupid cute & paste error in init_md5() git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@47 7dcaeef0-15fb-0310-b436-a5af3365683c
-rw-r--r--libssh/buffer.c4
-rw-r--r--libssh/channels.c5
-rw-r--r--libssh/wrapper.c2
3 files changed, 8 insertions, 3 deletions
diff --git a/libssh/buffer.c b/libssh/buffer.c
index 9cdf8599..ade6f02f 100644
--- a/libssh/buffer.c
+++ b/libssh/buffer.c
@@ -31,10 +31,12 @@ BUFFER *buffer_new(){
}
void buffer_free(BUFFER *buffer){
+// printf("buffer %p : free(%p);\n",buffer,buffer->data);
if(buffer->data){
memset(buffer->data,0,buffer->allocated); /* burn the data */
free(buffer->data);
}
+ memset(buffer,'x',sizeof (*buffer));
free(buffer);
}
@@ -46,7 +48,9 @@ void buffer_reinit(BUFFER *buffer){
static void realloc_buffer(BUFFER *buffer,int needed){
needed=(needed+0x7f) & ~0x7f;
+// printf("buffer %p : realloc(%x,%d)=",buffer,buffer->data,needed);
buffer->data=realloc(buffer->data,needed);
+// printf("%p\n",buffer->data);
buffer->allocated=needed;
}
diff --git a/libssh/channels.c b/libssh/channels.c
index 83686af0..78b66cb5 100644
--- a/libssh/channels.c
+++ b/libssh/channels.c
@@ -722,7 +722,8 @@ static int channel_protocol_select(CHANNEL **rchans, CHANNEL **wchans, CHANNEL *
ssh_handle_packets(chan->session);
}
if( (chan->stdout_buffer && buffer_get_len(chan->stdout_buffer)>0) ||
- (chan->stderr_buffer && buffer_get_len(chan->stderr_buffer)>0)){
+ (chan->stderr_buffer && buffer_get_len(chan->stderr_buffer)>0) ||
+ chan->remote_eof){
rout[j]=chan;
++j;
}
@@ -741,7 +742,7 @@ static int channel_protocol_select(CHANNEL **rchans, CHANNEL **wchans, CHANNEL *
j=0;
for(i=0;echans[i];++i){
chan=echans[i];
- if(chan->session->fd==-1 || !chan->open || chan->remote_eof || chan->session->data_except){
+ if(chan->session->fd==-1 || !chan->open || chan->session->data_except){
eout[j]=chan;
++j;
}
diff --git a/libssh/wrapper.c b/libssh/wrapper.c
index f6abb3bb..a731d1e8 100644
--- a/libssh/wrapper.c
+++ b/libssh/wrapper.c
@@ -239,7 +239,7 @@ void sha1(unsigned char *digest,int len,unsigned char *hash){
}
MD5CTX md5_init(){
- MD5CTX c=malloc(sizeof(c));
+ MD5CTX c=malloc(sizeof(*c));
MD5_Init(c);
return c;
}