From fa6194e701e64bcb5567cd209999818d59f6c660 Mon Sep 17 00:00:00 2001 From: Dustin Lundquist Date: Tue, 5 Feb 2013 15:40:04 -0800 Subject: [PATCH] Fix truncated response issue When using AF_UNIX for the remote socket, we ran into the case we attempted to read() zero bytes from the remote socket. This returned 0 which was handled as the remote socket being closed rather than the expected return value for a read of length zero. --- src/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client.c b/src/client.c index 5fa5d15..b6ec4e9 100644 --- a/src/client.c +++ b/src/client.c @@ -653,7 +653,7 @@ static void transfer(CLI *c) { } /****************************** read from socket */ - if(sock_open_rd && sock_can_rd) { + if(sock_open_rd && sock_can_rd && BUFFSIZE-c->sock_ptr > 0) { num=readsocket(c->sock_rfd->fd, c->sock_buff+c->sock_ptr, BUFFSIZE-c->sock_ptr); switch(num) { -- 1.7.10.4