summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorWill Storey <will@summercat.com>2017-10-10 18:21:05 -0700
committerWill Storey <will@summercat.com>2017-10-10 18:21:05 -0700
commit174adee9dd91c23615f79b979b3b3c5f72ad1240 (patch)
treea1dd68c012767031c5051f53d32723492e81c009 /src/core
parent4ccff71f678f79da71713a29d8528812379bb584 (diff)
downloadirssi-174adee9dd91c23615f79b979b3b3c5f72ad1240.zip
Always initialize the host string
This also removes a wordy comment
Diffstat (limited to 'src/core')
-rw-r--r--src/core/network.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/src/core/network.c b/src/core/network.c
index 8d9c6b06..b38c9102 100644
--- a/src/core/network.c
+++ b/src/core/network.c
@@ -489,16 +489,8 @@ int net_gethostbyaddr(IPADDR *ip, char **name)
int net_ip2host(IPADDR *ip, char *host)
{
- if (inet_ntop(ip->family, &ip->ip, host, MAX_IP_LEN)) {
- return 0;
- }
-
- // For callers that do not check our return value and pass in an
- // uninitialized buffer assuming it will be set, ensure the buffer is a valid
- // string. Ideally callers should check what we return and handle
- // appropriately, but this at least gives us safety.
host[0] = '\0';
- return -1;
+ return inet_ntop(ip->family, &ip->ip, host, MAX_IP_LEN) ? 0 : -1;
}
int net_host2ip(const char *host, IPADDR *ip)