summaryrefslogtreecommitdiff
path: root/netlib.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2017-09-06 19:00:04 -0400
committerEric S. Raymond <esr@thyrsus.com>2017-09-06 19:00:04 -0400
commit9c7e8629876fb3ff115902e37fe562641ce9de11 (patch)
tree08ca2e4206ccc0dbda2ee946d907763ae9166aab /netlib.c
parentdb56959e1cf2670edb02f27f25580bb4272e9df2 (diff)
downloadgpsd-9c7e8629876fb3ff115902e37fe562641ce9de11.tar.gz
Clean up C and Python code-checker warnings.
Diffstat (limited to 'netlib.c')
-rw-r--r--netlib.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/netlib.c b/netlib.c
index 2939454d..4da16aaf 100644
--- a/netlib.c
+++ b/netlib.c
@@ -210,8 +210,8 @@ char *netlib_sock2ip(socket_t fd)
/* retrieve the IP address corresponding to a socket */
{
static char ip[INET6_ADDRSTRLEN];
- int r = 1;
#ifdef HAVE_INET_NTOP
+ int r;
sockaddr_t fsin;
socklen_t alen = (socklen_t) sizeof(fsin);
r = getpeername(fd, &(fsin.sa), &alen);
@@ -232,9 +232,9 @@ char *netlib_sock2ip(socket_t fd)
return ip;
}
}
+ /* Ugh... */
+ if (r != 0)
#endif /* HAVE_INET_NTOP */
- if (r != 0) {
(void)strlcpy(ip, "<unknown>", sizeof(ip));
- }
return ip;
}