From: Ruben Kerkhof Date: Wed, 10 Aug 2016 11:04:27 +0000 (+0200) Subject: common.c: fix compilation on OpenBSD X-Git-Tag: collectd-5.6.0~63 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=ee830b46965eac77e608d536c51d15062b9842bb;p=collectd.git 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') --- 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)