1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-18 13:39:02 +00:00

Code cleanup.

Made get_peeraddr_string() return "peer unspecified" if peerlen <= 0.
This saves a handful duplicate lines that did the check externally.
This commit is contained in:
henri
2013-06-15 12:33:27 +00:00
parent 6238087e9b
commit a493296c54
4 changed files with 18 additions and 34 deletions

View File

@@ -186,7 +186,10 @@ static char *get_addr_string(const struct sockaddr_storage *ss, size_t sslen) {
* string containing path to UNIX socket if the address family is AF_UNIX,
* otherwise it returns string containing "<address>:<port>". */
char *get_peeraddr_string(const msiod *iod) {
return get_addr_string(&iod->peer, iod->peerlen);
if (iod->peerlen > 0)
return get_addr_string(&iod->peer, iod->peerlen);
else
return "peer unspecified";
}
/* Get the local bind address string. */