Unix: set addrlen so async reconnect uses proper size

This commit is contained in:
Mark Nunberg 2018-12-13 11:24:40 -05:00
parent f51363a70c
commit 3a547b8ec0

3
net.c
View File

@ -502,7 +502,8 @@ int redisContextConnectUnix(redisContext *c, const char *path, const struct time
sa = (struct sockaddr_un*)(c->saddr = malloc(sizeof(struct sockaddr_un)));
c->addrlen = sizeof(struct sockaddr_un);
sa->sun_family = AF_UNIX;
strncpy(sa->sun_path,path,sizeof(sa->sun_path)-1);
c->addrlen = sizeof(*sa);
strncpy(sa->sun_path, path, sizeof(sa->sun_path) - 1);
if (connect(c->fd, (struct sockaddr*)sa, sizeof(*sa)) == -1) {
if (errno == EINPROGRESS && !blocking) {
/* This is ok. */