Use AF_UNIX
AF_LOCAL is the old, non-standardized name for AF_UNIX. Just use AF_UNIX, rather than wrestling with platform specifics of AF_LOCAL definitions. Signed-off-by: Justin Brewer <jzb0012@auburn.edu>
This commit is contained in:
parent
3d8709d19d
commit
bbeab80090
4
net.c
4
net.c
@ -432,7 +432,7 @@ int redisContextConnectUnix(redisContext *c, const char *path, const struct time
|
|||||||
struct sockaddr_un sa;
|
struct sockaddr_un sa;
|
||||||
long timeout_msec = -1;
|
long timeout_msec = -1;
|
||||||
|
|
||||||
if (redisCreateSocket(c,AF_LOCAL) < 0)
|
if (redisCreateSocket(c,AF_UNIX) < 0)
|
||||||
return REDIS_ERR;
|
return REDIS_ERR;
|
||||||
if (redisSetBlocking(c,0) != REDIS_OK)
|
if (redisSetBlocking(c,0) != REDIS_OK)
|
||||||
return REDIS_ERR;
|
return REDIS_ERR;
|
||||||
@ -457,7 +457,7 @@ int redisContextConnectUnix(redisContext *c, const char *path, const struct time
|
|||||||
if (redisContextTimeoutMsec(c,&timeout_msec) != REDIS_OK)
|
if (redisContextTimeoutMsec(c,&timeout_msec) != REDIS_OK)
|
||||||
return REDIS_ERR;
|
return REDIS_ERR;
|
||||||
|
|
||||||
sa.sun_family = AF_LOCAL;
|
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 == EINPROGRESS && !blocking) {
|
||||||
|
4
net.h
4
net.h
@ -37,10 +37,6 @@
|
|||||||
|
|
||||||
#include "hiredis.h"
|
#include "hiredis.h"
|
||||||
|
|
||||||
#if defined(__sun) || defined(AIX)
|
|
||||||
#define AF_LOCAL AF_UNIX
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int redisCheckSocketError(redisContext *c);
|
int redisCheckSocketError(redisContext *c);
|
||||||
int redisContextSetTimeout(redisContext *c, const struct timeval tv);
|
int redisContextSetTimeout(redisContext *c, const struct timeval tv);
|
||||||
int redisContextConnectTcp(redisContext *c, const char *addr, int port, const struct timeval *timeout);
|
int redisContextConnectTcp(redisContext *c, const char *addr, int port, const struct timeval *timeout);
|
||||||
|
Loading…
Reference in New Issue
Block a user