mirror of
https://github.com/fluencelabs/redis
synced 2025-03-18 16:40:50 +00:00
anetPeerToString / SockName: port can be NULL on errors too.
This commit is contained in:
parent
a2a900356e
commit
2041882286
@ -488,7 +488,7 @@ int anetPeerToString(int fd, char *ip, size_t ip_len, int *port) {
|
||||
socklen_t salen = sizeof(sa);
|
||||
|
||||
if (getpeername(fd,(struct sockaddr*)&sa,&salen) == -1) {
|
||||
*port = 0;
|
||||
if (port) *port = 0;
|
||||
ip[0] = '?';
|
||||
ip[1] = '\0';
|
||||
return -1;
|
||||
@ -510,7 +510,7 @@ int anetSockName(int fd, char *ip, size_t ip_len, int *port) {
|
||||
socklen_t salen = sizeof(sa);
|
||||
|
||||
if (getsockname(fd,(struct sockaddr*)&sa,&salen) == -1) {
|
||||
*port = 0;
|
||||
if (port) *port = 0;
|
||||
ip[0] = '?';
|
||||
ip[1] = '\0';
|
||||
return -1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user