From 98ee1a638880f794c89ca9f9aaf9aa31a68ce100 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Thu, 20 Aug 2009 14:10:37 +0200 Subject: [PATCH] df plugin: Check ignorelists before stat'ing the filesystem. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit → See also: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=542859 --- src/df.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/df.c b/src/df.c index 38079d87..2c59b01c 100644 --- a/src/df.c +++ b/src/df.c @@ -155,22 +155,6 @@ static int df_read (void) for (mnt_ptr = mnt_list; mnt_ptr != NULL; mnt_ptr = mnt_ptr->next) { - if (STATANYFS (mnt_ptr->dir, &statbuf) < 0) - { - char errbuf[1024]; - ERROR ("statv?fs failed: %s", - sstrerror (errno, errbuf, - sizeof (errbuf))); - continue; - } - - if (!statbuf.f_blocks) - continue; - - blocksize = BLOCKSIZE(statbuf); - df_free = statbuf.f_bfree * blocksize; - df_used = (statbuf.f_blocks - statbuf.f_bfree) * blocksize; - if (strcmp (mnt_ptr->dir, "/") == 0) { sstrncpy (mnt_name, "root", sizeof (mnt_name)); @@ -197,6 +181,22 @@ static int df_read (void) if (ignorelist_match (il_fstype, mnt_ptr->type)) continue; + if (STATANYFS (mnt_ptr->dir, &statbuf) < 0) + { + char errbuf[1024]; + ERROR ("statv?fs failed: %s", + sstrerror (errno, errbuf, + sizeof (errbuf))); + continue; + } + + if (!statbuf.f_blocks) + continue; + + blocksize = BLOCKSIZE(statbuf); + df_free = statbuf.f_bfree * blocksize; + df_used = (statbuf.f_blocks - statbuf.f_bfree) * blocksize; + df_submit (mnt_name, df_used, df_free); } -- 2.11.0