[sheepdog] [PATCH] reconnect in case of EINTR

MORITA Kazutaka morita.kazutaka at gmail.com
Sat May 4 11:19:14 CEST 2013


From: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>

Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 lib/net.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/net.c b/lib/net.c
index ebb0da6..464ccb7 100644
--- a/lib/net.c
+++ b/lib/net.c
@@ -245,9 +245,11 @@ int connect_to(const char *name, int port)
 			close(fd);
 			break;
 		}
-
+reconnect:
 		ret = connect(fd, res->ai_addr, res->ai_addrlen);
 		if (ret) {
+			if (errno == EINTR)
+				goto reconnect;
 			sd_eprintf("failed to connect to %s:%d: %m", name,
 				   port);
 			close(fd);
-- 
1.7.9.5




More information about the sheepdog mailing list