From 3a547b8ec045704bf4836d0c5c9657fa311698f0 Mon Sep 17 00:00:00 2001 From: Mark Nunberg Date: Thu, 13 Dec 2018 11:24:40 -0500 Subject: Unix: set addrlen so async reconnect uses proper size --- net.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net.c b/net.c index f09183e..45dca7a 100644 --- a/net.c +++ b/net.c @@ -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. */ -- cgit v1.2.3