[Openvpn-devel,v1] route: Fix a unused-but-set-variable warning on OpenBSD

Message ID 20251004141935.17815-1-gert@greenie.muc.de
State New
Headers show
Series [Openvpn-devel,v1] route: Fix a unused-but-set-variable warning on OpenBSD | expand

Commit Message

Gert Doering Oct. 4, 2025, 2:19 p.m. UTC
From: Frank Lichtenheld <frank@lichtenheld.com>

So we could enable -Werror for OpenBSD builds.

Change-Id: Ic971604beb1320d7b9d6121cd8e8519ccc1a7eb9
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: MaxF <max@max-fillinger.net>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1214
---

This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1214
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
MaxF <max@max-fillinger.net>

Comments

Gert Doering Oct. 4, 2025, 4:05 p.m. UTC | #1
This is not my most favourite patch in this series... but the alternative
is "more #ifdefs" (nah) or "more code duplication" (nah).  In these system
dependent parts, some compromises need to be made... 

Didn't actually *test* anything, as it's very explicit not doing anything :-)
(and BB says "it still compiles and tests fine everywhere").

Your patch has been applied to the master branch.

commit 9243ea88913fc1bed26c25ba7d7b18bb2f16fa4c
Author: Frank Lichtenheld
Date:   Sat Oct 4 16:19:30 2025 +0200

     route: Fix a unused-but-set-variable warning on OpenBSD

     Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
     Acked-by: MaxF <max@max-fillinger.net>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1214
     Message-Id: <20251004141935.17815-1-gert@greenie.muc.de>
     URL: https://sourceforge.net/p/openvpn/mailman/message/59242246/
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpn/route.c b/src/openvpn/route.c
index 156a99e..05a0c8f 100644
--- a/src/openvpn/route.c
+++ b/src/openvpn/route.c
@@ -2221,6 +2221,7 @@ 
         device = r6->iface;
         gateway_needed = true;
     }
+    (void)device; /* unused on some platforms */
 
     /* if we used a gateway on "add route", we also need to specify it on
      * delete, otherwise some OSes will refuse to delete the route