summaryrefslogtreecommitdiff
path: root/src/anet.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2013-12-25 18:39:49 +0100
committerantirez <antirez@gmail.com>2013-12-25 18:41:49 +0100
commit20418822867065cdbbeffc05a0bd0abae64284ff (patch)
tree7c39dd20a130960e4461a5fb1c3797bfed7a9f66 /src/anet.c
parenta2a900356e62628588742dd6b2de8c8d55b86784 (diff)
downloadredis-20418822867065cdbbeffc05a0bd0abae64284ff.tar.gz
anetPeerToString / SockName: port can be NULL on errors too.
Diffstat (limited to 'src/anet.c')
-rw-r--r--src/anet.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/anet.c b/src/anet.c
index e37ae8064..ef52d955d 100644
--- a/src/anet.c
+++ b/src/anet.c
@@ -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;