From 6295f933454fc794535e7b3c2d909801cf15a493 Mon Sep 17 00:00:00 2001 From: Hannes Mehnert Date: Mon, 11 Jul 2022 22:44:37 +0200 Subject: [PATCH] tenders, FreeBSD, tap: Ignore "up" variable to avoid compiler warning The unused-but-set-variable warning was emitted for the variable "up", which is not used on FreeBSD. To keep the code simple (not introducing further ifdefs), just ignore it via an empty conditional. Fixes #519. --- tenders/common/tap_attach.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tenders/common/tap_attach.c b/tenders/common/tap_attach.c index 84e67dab..1b608667 100644 --- a/tenders/common/tap_attach.c +++ b/tenders/common/tap_attach.c @@ -162,6 +162,13 @@ int tap_attach(const char *ifname) #elif defined(__FreeBSD__) + /* + * Avoid unused-but-set-variable warning on FreeBSD, where the tap device + * is only up once open() was called by the process. + */ + if (!up) + ; + char devname[strlen(ifname) + 6]; snprintf(devname, sizeof devname, "/dev/%s", ifname);