mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 09:00:51 +00:00
Merge pull request #3856 from viennadd/issue-3847
fix #3847: add close socket before return ANET_ERR.
This commit is contained in:
commit
332a05dc33
@ -380,8 +380,10 @@ int anetUnixGenericConnect(char *err, char *path, int flags)
|
|||||||
sa.sun_family = AF_LOCAL;
|
sa.sun_family = AF_LOCAL;
|
||||||
strncpy(sa.sun_path,path,sizeof(sa.sun_path)-1);
|
strncpy(sa.sun_path,path,sizeof(sa.sun_path)-1);
|
||||||
if (flags & ANET_CONNECT_NONBLOCK) {
|
if (flags & ANET_CONNECT_NONBLOCK) {
|
||||||
if (anetNonBlock(err,s) != ANET_OK)
|
if (anetNonBlock(err,s) != ANET_OK) {
|
||||||
|
close(s);
|
||||||
return ANET_ERR;
|
return ANET_ERR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (connect(s,(struct sockaddr*)&sa,sizeof(sa)) == -1) {
|
if (connect(s,(struct sockaddr*)&sa,sizeof(sa)) == -1) {
|
||||||
if (errno == EINPROGRESS &&
|
if (errno == EINPROGRESS &&
|
||||||
|
Loading…
x
Reference in New Issue
Block a user