From 5708ec7d98e26bb7f57cc1c50eb056848cfb7702 Mon Sep 17 00:00:00 2001 From: Marko Kreen Date: Fri, 4 Jan 2008 09:12:54 +0000 Subject: [PATCH] handle EINTR from connect() --- src/sbuf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sbuf.c b/src/sbuf.c index 7b66739..da7198c 100644 --- a/src/sbuf.c +++ b/src/sbuf.c @@ -153,18 +153,21 @@ bool sbuf_connect(SBuf *sbuf, const PgAddr *addr, const char *unix_dir, int time timeout.tv_usec = 0; /* launch connection */ +loop: res = connect(sock, sa, len); log_noise("connect(%d)=%d", sock, res); if (res == 0) { /* unix socket gives connection immidiately */ sbuf_connect_cb(sock, EV_WRITE, sbuf); return true; - } else if (res < 0 && errno == EINPROGRESS) { + } else if (errno == EINPROGRESS) { /* tcp socket needs waiting */ event_set(&sbuf->ev, sock, EV_WRITE, sbuf_connect_cb, sbuf); res = event_add(&sbuf->ev, &timeout); if (res >= 0) return true; + } else if (errno == EINTR) { + goto loop; } failed: -- 2.40.0