From: Sergio Durigan Junior Date: Wed, 22 Apr 2026 20:49:05 +0000 (-0400) Subject: virt: Fix GCC 16's -Wunused-but-set-variable X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=107b975dfa49d814e5ef3434249efff20f1cebd5;p=thirdparty%2Fcollectd.git virt: Fix GCC 16's -Wunused-but-set-variable GCC 16 started treating these are errors, which leads to a build failure. Signed-off-by: Sergio Durigan Junior --- diff --git a/src/virt.c b/src/virt.c index a9374aa2d..f0120fe77 100644 --- a/src/virt.c +++ b/src/virt.c @@ -2343,11 +2343,15 @@ static int persistent_domains_state_notification(void) { } else { DEBUG(PLUGIN_NAME " plugin: getting state of %i persistent domains", n); /* Fetch each persistent domain's state and notify it */ +#if COLLECT_DEBUG int n_notified = n; +#endif for (int i = 0; i < n; ++i) { status = get_domain_state_notify(domains[i]); if (status != 0) { +#if COLLECT_DEBUG n_notified--; +#endif ERROR(PLUGIN_NAME " plugin: could not notify state of domain %s", virDomainGetName(domains[i])); }