summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4d04d3b)
raw | patch | inline | side by side (parent: 4d04d3b)
author | Florian Forster <octo@collectd.org> | |
Sat, 5 Dec 2015 21:23:05 +0000 (22:23 +0100) | ||
committer | Florian Forster <octo@collectd.org> | |
Sat, 5 Dec 2015 21:23:52 +0000 (22:23 +0100) |
Coverity CID 37944.
Signed-off-by: Florian Forster <octo@collectd.org>
Signed-off-by: Florian Forster <octo@collectd.org>
src/libcollectdclient/network.c | patch | blob | history |
index 6b6450c9b785171547c3fef30a50e28acd02340f..6733cda4de758929d842fef81d0f2df2b85d7861 100644 (file)
if (ai_ptr->ai_family == AF_INET)
{
-
struct sockaddr_in *addr = (struct sockaddr_in *) ai_ptr->ai_addr;
int optname;
else
optname = IP_TTL;
- setsockopt (srv->fd, IPPROTO_IP, optname,
- &srv->ttl,
- sizeof (srv->ttl));
+ status = setsockopt (srv->fd, IPPROTO_IP, optname,
+ &srv->ttl, sizeof (srv->ttl));
}
else if (ai_ptr->ai_family == AF_INET6)
{
else
optname = IPV6_UNICAST_HOPS;
- setsockopt (srv->fd, IPPROTO_IPV6, optname,
- &srv->ttl,
- sizeof (srv->ttl));
+ status = setsockopt (srv->fd, IPPROTO_IPV6, optname,
+ &srv->ttl, sizeof (srv->ttl));
+ }
+ if (status != 0)
+ {
+ /* setsockopt failed. */
+ close (srv->fd);
+ srv->fd = -1;
+ continue;
}
srv->sa = malloc (ai_ptr->ai_addrlen);