[collectd] [PATCH] Fix setsockopt for SO_REUSEADDR since value of loop variable changed

Pavel Shramov shramov at mexmat.net
Tue Dec 4 15:43:35 CET 2007


---
 src/network.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/network.c b/src/network.c
index ab04f4c..7aaf218 100644
--- a/src/network.c
+++ b/src/network.c
@@ -682,10 +682,11 @@ static int network_set_ttl (const sockent_t *se, const struct addrinfo *ai)
 static int network_bind_socket (const sockent_t *se, const struct addrinfo *ai)
 {
 	int loop = 0;
+	int yes  = 1;
 
 	/* allow multiple sockets to use the same PORT number */
 	if (setsockopt(se->fd, SOL_SOCKET, SO_REUSEADDR,
-				&loop, sizeof(loop)) == -1) {
+				&yes, sizeof(yes)) == -1) {
                 char errbuf[1024];
                 ERROR ("setsockopt: %s", 
                                 sstrerror (errno, errbuf, sizeof (errbuf)));
-- 
1.5.3.5




More information about the collectd mailing list