[PATCH] bs_sheepdog.c: fix a descriptor leak in connect_to_sdog_tcp()

Ryusuke Konishi <[email protected]>
Newsgroups org.kernel.vger.stgt
Message-ID <[email protected]>
When connect_to_sdoc_tcp function failed to connect a socket due to an
error other than EINTR, it doesn't free the socket file descriptor.

This fixes the leak bug.

Signed-off-by: Ryusuke Konishi <[email protected]>
---
 usr/bs_sheepdog.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/usr/bs_sheepdog.c b/usr/bs_sheepdog.c
index 3edc720..07ad0de 100644
--- a/usr/bs_sheepdog.c
+++ b/usr/bs_sheepdog.c
@@ -372,6 +372,7 @@ reconnect:
 			if (errno == EINTR)
 				goto reconnect;
 
+			close(fd);
 			break;
 		}
 
-- 
1.7.9.3
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.