From 86f8abbafa7a174299caa435c7e0bc5d07b84968 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Sat, 30 Jun 2012 16:33:09 +0200 Subject: [PATCH] swap plugin: Don't report an error if there is no swap space on Linux. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit … 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. --- src/swap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- 2.30.2