From: Marko Kreen Date: Fri, 4 Jan 2008 09:13:05 +0000 (+0000) Subject: handle EINTR from connect() X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=6a61f75dfe714eb8b46e3aaaab6615546f078bf8;p=pgbouncer.git handle EINTR from connect() --- diff --git a/src/sbuf.c b/src/sbuf.c index 8959592..ee9f667 100644 --- a/src/sbuf.c +++ b/src/sbuf.c @@ -149,6 +149,7 @@ void 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) { @@ -158,6 +159,8 @@ void sbuf_connect(SBuf *sbuf, const PgAddr *addr, const char *unix_dir, int time /* tcp socket needs waiting */ event_set(&sbuf->ev, sock, EV_WRITE, sbuf_connect_cb, sbuf); event_add(&sbuf->ev, &timeout); + } else if (res < 0 && errno == EINTR) { + goto loop; } else { /* failure */ log_warning("connect failed: res=%d/err=%s", res, strerror(errno));