Commit c1c6479cbe for frr
commit c1c6479cbe50b75f555b6d75083c8ebff4262cbf
Author: Vincent Jardin <vjardin@free.fr>
Date: Mon Nov 9 19:11:07 2026 +0100
lib: fix unused variable in sockopt_minttl()
On a platform that has neither IP_MINTTL nor IPV6_MINHOPCOUNT (macos),
both #ifdef blocks drop out and clang complains:
lib/sockopt.c:823:6: warning: unused variable 'ret' [-Wunused-variable]
Signed-off-by: Vincent Jardin <vjardin@free.fr>
diff --git a/lib/sockopt.c b/lib/sockopt.c
index fb2f7d1e49..db7abf855a 100644
--- a/lib/sockopt.c
+++ b/lib/sockopt.c
@@ -846,10 +846,10 @@ int sockopt_ttl(int family, int sock, int ttl)
int sockopt_minttl(int family, int sock, int minttl)
{
- int ret;
-
#ifdef IP_MINTTL
if (family == AF_INET) {
+ int ret;
+
ret = setsockopt(sock, IPPROTO_IP, IP_MINTTL, &minttl, sizeof(minttl));
if (ret < 0)
@@ -861,6 +861,8 @@ int sockopt_minttl(int family, int sock, int minttl)
#endif /* IP_MINTTL */
#ifdef IPV6_MINHOPCOUNT
if (family == AF_INET6) {
+ int ret;
+
ret = setsockopt(sock, IPPROTO_IPV6, IPV6_MINHOPCOUNT, &minttl, sizeof(minttl));
if (ret < 0)
flog_err(EC_LIB_SOCKET,