Commit 329346bb authored by michael-grunder's avatar michael-grunder Committed by Michael Grunder
Browse files

Test for both EAGAIN and EINPROGRESS for AF_UNIX sockets.

Reading the manpage it seems like we only need to test for `EAGAIN` but
testing for both seems more prudent since this may be subtly different
on more esoteric kernels (SunOS, AIX, BSD, etc).

Fixes #1260
parent 0c63e3f3
...@@ -668,7 +668,7 @@ int redisContextConnectUnix(redisContext *c, const char *path, const struct time ...@@ -668,7 +668,7 @@ int redisContextConnectUnix(redisContext *c, const char *path, const struct time
sa->sun_family = AF_UNIX; sa->sun_family = AF_UNIX;
strncpy(sa->sun_path, path, sizeof(sa->sun_path) - 1); strncpy(sa->sun_path, path, sizeof(sa->sun_path) - 1);
if (connect(c->fd, (struct sockaddr*)sa, sizeof(*sa)) == -1) { if (connect(c->fd, (struct sockaddr*)sa, sizeof(*sa)) == -1) {
if (errno == EINPROGRESS && !blocking) { if ((errno == EAGAIN || errno == EINPROGRESS) && !blocking) {
/* This is ok. */ /* This is ok. */
} else { } else {
if (redisContextWaitReady(c,timeout_msec) != REDIS_OK) if (redisContextWaitReady(c,timeout_msec) != REDIS_OK)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment