Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
hiredis
Commits
088d1469
Commit
088d1469
authored
Dec 05, 2018
by
Mark Nunberg
Browse files
Fix regression when connecting with Unix sockets (#629)
parent
8633a2f3
Changes
1
Hide whitespace changes
Inline
Side-by-side
net.c
View file @
088d1469
...
...
@@ -472,7 +472,7 @@ int redisContextConnectBindTcp(redisContext *c, const char *addr, int port,
int
redisContextConnectUnix
(
redisContext
*
c
,
const
char
*
path
,
const
struct
timeval
*
timeout
)
{
int
blocking
=
(
c
->
flags
&
REDIS_BLOCK
);
struct
sockaddr_un
sa
;
struct
sockaddr_un
*
sa
;
long
timeout_msec
=
-
1
;
if
(
redisCreateSocket
(
c
,
AF_UNIX
)
<
0
)
...
...
@@ -499,9 +499,10 @@ int redisContextConnectUnix(redisContext *c, const char *path, const struct time
if
(
redisContextTimeoutMsec
(
c
,
&
timeout_msec
)
!=
REDIS_OK
)
return
REDIS_ERR
;
sa
.
sun_family
=
AF_UNIX
;
strncpy
(
sa
.
sun_path
,
path
,
sizeof
(
sa
.
sun_path
)
-
1
);
if
(
connect
(
c
->
fd
,
(
struct
sockaddr
*
)
&
sa
,
sizeof
(
sa
))
==
-
1
)
{
sa
=
(
struct
sockaddr_un
*
)(
c
->
saddr
=
malloc
(
sizeof
(
struct
sockaddr_un
)));
sa
->
sun_family
=
AF_UNIX
;
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. */
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment