From ee830b46965eac77e608d536c51d15062b9842bb Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Wed, 10 Aug 2016 13:04:27 +0200 Subject: [PATCH] common.c: fix compilation on OpenBSD cc1: warnings being treated as errors common.c: In function 'set_sock_opts': common.c:1572: warning: unused variable 'tcp_keepintvl' common.c:1571: warning: unused variable 'tcp_keepidle' *** Error 1 in target 'common.lo' *** Error 1 in src/daemon (Makefile:1048 'common.lo': @echo " CC " common.lo;depbase=`echo common.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$|...) *** Error 1 in src (Makefile:5007 'all-recursive') *** Error 2 in src (Makefile:3284 'all') *** Error 1 in /root/src/collectd (Makefile:611 'all-recursive') --- src/daemon/common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/daemon/common.c b/src/daemon/common.c index c4dbecbe..c6559a80 100644 --- a/src/daemon/common.c +++ b/src/daemon/common.c @@ -1568,8 +1568,6 @@ void set_sock_opts (int sockfd) /* {{{ */ socklen_t socklen = sizeof (socklen_t); int so_keepalive = 1; - int tcp_keepidle = ((CDTIME_T_TO_MS(plugin_get_interval()) - 1) / 100 + 1); - int tcp_keepintvl = ((CDTIME_T_TO_MS(plugin_get_interval()) - 1) / 1000 + 1); status = getsockopt (sockfd, SOL_SOCKET, SO_TYPE, &socktype, &socklen); if (status != 0) @@ -1586,6 +1584,7 @@ void set_sock_opts (int sockfd) /* {{{ */ WARNING ("set_sock_opts: failed to set socket keepalive flag"); #ifdef TCP_KEEPIDLE + int tcp_keepidle = ((CDTIME_T_TO_MS(plugin_get_interval()) - 1) / 100 + 1); status = setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPIDLE, &tcp_keepidle, sizeof (tcp_keepidle)); if (status != 0) @@ -1593,6 +1592,7 @@ void set_sock_opts (int sockfd) /* {{{ */ #endif #ifdef TCP_KEEPINTVL + int tcp_keepintvl = ((CDTIME_T_TO_MS(plugin_get_interval()) - 1) / 1000 + 1); status = setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPINTVL, &tcp_keepintvl, sizeof (tcp_keepintvl)); if (status != 0) -- 2.30.2