Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
27d06111
Commit
27d06111
authored
Dec 25, 2013
by
antirez
Browse files
anetPeerToString / SockName: port can be NULL on errors too.
parent
5b7c1613
Changes
1
Show whitespace changes
Inline
Side-by-side
src/anet.c
View file @
27d06111
...
...
@@ -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
;
...
...
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