From: Sebastian Harl Date: Sat, 30 Jun 2012 14:33:09 +0000 (+0200) Subject: swap plugin: Don't report an error if there is no swap space on Linux. X-Git-Tag: collectd-5.0.5~17^2 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=86f8abbafa7a174299caa435c7e0bc5d07b84968;p=collectd.git swap plugin: Don't report an error if there is no swap space on Linux. … rather, simply record zeros in that case. Swap may be switched on and off at arbitrary times and/or might be added at "later" times. Thus, storing zero in case the swap plugin is enabled sounds like the best approach to me. --- diff --git a/src/swap.c b/src/swap.c index 629d1a1e..30daa4b1 100644 --- a/src/swap.c +++ b/src/swap.c @@ -239,7 +239,7 @@ static int swap_read (void) /* {{{ */ sstrerror (errno, errbuf, sizeof (errbuf))); } - if ((swap_total == 0LL) || ((swap_free + swap_cached) > swap_total)) + if ((swap_free + swap_cached) > swap_total) return (-1); swap_used = swap_total - (swap_free + swap_cached);