From a123051200b5052057d2bed660283e4364d3e3e9 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sat, 12 May 2012 22:37:20 +0200 Subject: [PATCH] sftp_packetlist_flush: zombies must not have responses already When flushing the packetlist, we must only add the request as a zombie if no response has already been received. Otherwise we could wrongly make it a zombie even though the response was already received and then we'd get a zombie stuck there "forever"... --- src/sftp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sftp.c b/src/sftp.c index 7a699f36..2bfee589 100644 --- a/src/sftp.c +++ b/src/sftp.c @@ -430,10 +430,6 @@ static void sftp_packetlist_flush(LIBSSH2_SFTP_HANDLE *handle) int rc; struct sftp_pipeline_chunk *next = _libssh2_list_next(&chunk->node); - /* mark this request as a zombie if it ever sent anything */ - if(chunk->sent) - add_zombie_request(sftp, chunk->request_id); - rc = sftp_packet_ask(sftp, SSH_FXP_STATUS, chunk->request_id, &data, &data_len); if(rc) @@ -443,6 +439,10 @@ static void sftp_packetlist_flush(LIBSSH2_SFTP_HANDLE *handle) if(!rc) /* we found a packet, free it */ LIBSSH2_FREE(session, data); + else if(chunk->sent) + /* there was no incoming packet for this request, mark this + request as a zombie if it ever sent the request */ + add_zombie_request(sftp, chunk->request_id); _libssh2_list_remove(&chunk->node); LIBSSH2_FREE(session, chunk);