]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
virt: Fix GCC 16's -Wunused-but-set-variable
authorSergio Durigan Junior <sergiodj@sergiodj.net>
Wed, 22 Apr 2026 20:49:05 +0000 (16:49 -0400)
committerMatthias Runge <mrunge@matthias-runge.de>
Fri, 29 May 2026 12:58:03 +0000 (14:58 +0200)
GCC 16 started treating these are errors, which leads to a build
failure.

Signed-off-by: Sergio Durigan Junior <sergiodj@sergiodj.net>
src/virt.c

index a9374aa2df6ab4d4142d9d1d3ccb993b09b7a2c9..f0120fe7702c5a3b933970a9628389b5dfb52e93 100644 (file)
@@ -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]));
       }