dovecot-2.0: *-login: If connecting to anvil fails with EAGAIN, ...
dovecot at dovecot.org
dovecot at dovecot.org
Sat Sep 5 00:07:06 EEST 2009
details: http://hg.dovecot.org/dovecot-2.0/rev/199857627883
changeset: 9875:199857627883
user: Timo Sirainen <tss at iki.fi>
date: Fri Sep 04 17:06:31 2009 -0400
description:
*-login: If connecting to anvil fails with EAGAIN, try again a few times.
diffstat:
1 file changed, 7 insertions(+), 5 deletions(-)
src/login-common/main.c | 12 +++++++-----
diffs (22 lines):
diff -r 831adf94c39f -r 199857627883 src/login-common/main.c
--- a/src/login-common/main.c Fri Sep 04 17:05:21 2009 -0400
+++ b/src/login-common/main.c Fri Sep 04 17:06:31 2009 -0400
@@ -76,11 +76,13 @@ static int anvil_connect(void)
static int anvil_connect(void)
{
#define ANVIL_HANDSHAKE "VERSION\tanvil\t1\t0\n"
- int fd;
-
- fd = net_connect_unix("anvil");
- if (fd < 0)
- i_fatal("net_connect_unix(anvil) failed: %m");
+ int i = 0, fd;
+
+ while ((fd = net_connect_unix("anvil")) == -1) {
+ if (errno != EAGAIN || ++i == 3)
+ i_fatal("net_connect_unix(anvil) failed: %m");
+ sleep(1);
+ }
net_set_nonblock(fd, FALSE);
if (write(fd, ANVIL_HANDSHAKE, strlen(ANVIL_HANDSHAKE)) < 0)
More information about the dovecot-cvs
mailing list