X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fnetwork.c;h=64c6d24b2f4e187c073f70939c9f5b678af71bd0;hb=ffd3d91a3523381554d2199d97cb0fa538d1985b;hp=1e6ef14f33d4ed1fda498872ffe7f281b4514fbd;hpb=2b55b3c91907f1b95c59f2661448c336e51b61ce;p=collectd.git diff --git a/src/network.c b/src/network.c index 1e6ef14f..64c6d24b 100644 --- a/src/network.c +++ b/src/network.c @@ -1691,7 +1691,7 @@ static int network_bind_socket_to_addr(sockent_t *se, if (se->data.client.bind_addr == NULL) return 0; - ERROR("network plugin: failed to bind client socket (ipvX) to %s: %s", pbuffer, STRERRNO); + DEBUG("network_plugin: fd %i: bind socket to address", se->data.client.fd); char pbuffer[64]; if (ai->ai_family == AF_INET) { @@ -1701,8 +1701,8 @@ static int network_bind_socket_to_addr(sockent_t *se, DEBUG("network_plugin: binding client socket to ipv4 address: %s", pbuffer); if (bind(se->data.client.fd, (struct sockaddr *)addr, sizeof(*addr)) == -1) { - ERROR("network_plugin: failed to bind client socket (ipv4): %s", - STRERRNO); + ERROR("network plugin: failed to bind client socket (ipv4) to %s: %s", + pbuffer, STRERRNO); return -1; } } else if (ai->ai_family == AF_INET6) { @@ -1712,8 +1712,8 @@ static int network_bind_socket_to_addr(sockent_t *se, DEBUG("network_plugin: binding client socket to ipv6 address: %s", pbuffer); if (bind(se->data.client.fd, (struct sockaddr *)addr, sizeof(*addr)) == -1) { - ERROR("network_plugin: failed to bind client socket (ipv6): %s", - STRERRNO); + ERROR("network plugin: failed to bind client socket (ipv6) to %s: %s", + pbuffer, STRERRNO); return -1; } } @@ -1728,10 +1728,9 @@ static int network_bind_socket(int fd, const struct addrinfo *ai, #else int loop = 0; #endif - int yes = 1; /* allow multiple sockets to use the same PORT number */ - if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)) == -1) { + if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &(int){1}, sizeof(int)) == -1) { ERROR("network plugin: setsockopt (reuseaddr): %s", STRERRNO); return -1; }