Code

patches: Added bts542859-df-fix-ignorelist.dpatch.
authorSebastian Harl <sh@tokkee.org>
Thu, 27 Aug 2009 21:51:23 +0000 (23:51 +0200)
committerSebastian Harl <sh@tokkee.org>
Thu, 27 Aug 2009 21:51:23 +0000 (23:51 +0200)
This is an upstream patch to fix the handling of the ignorelist in the df
plugin.
Thanks to Joey Hess for reporting this.

Closes: #542859
debian/changelog
debian/patches/00list
debian/patches/bts542859-df-fix-ignorelist.dpatch [new file with mode: 0755]

index e6d693689a0c40da0d44621c9104a51d12d46283..9fae6c3a50801b61f84b6919f0dce9c71b9f3550 100644 (file)
@@ -50,6 +50,9 @@ collectd (4.7.2-1) unstable; urgency=low
       the handling of the LocalSocket config option of the powerdns plugin;
       thanks to Thomas Morgan for reporting this and Luke Heberling for
       providing a patch (references: #535787).
+    - Added bts542859-df-fix-ignorelist.dpatch - upstream patch to fix the
+      handling of the ignorelist in the df plugin; thanks to Joey Hess for
+      reporting this (Closes: #542859).
   * debian/README.Debian:
     - Removed the note about how to get collectd2html.pl working with
       version 4 of collectd - the script now supports the --recursive option
@@ -67,7 +70,7 @@ collectd (4.7.2-1) unstable; urgency=low
     - Set the 'apache' plugin's URL according to the default used by Debian's
       Apache; thanks to Joey Hess for reporting this (Closes: #541888).
 
- -- Sebastian Harl <tokkee@debian.org>  Thu, 27 Aug 2009 23:41:50 +0200
+ -- Sebastian Harl <tokkee@debian.org>  Thu, 27 Aug 2009 23:49:54 +0200
 
 collectd (4.6.3-1) unstable; urgency=low
 
index 06e05c44fd1cb213ff78287bf0d3babd36ea0d1f..2bf5010857541373f545fc41cc2e22cfa6abd358 100644 (file)
@@ -6,4 +6,5 @@ plugin-fix-unregister.dpatch
 java-fix-jvm-start.dpatch
 curl-followlocation.dpatch
 bts535787-powerdns-fix-localsocket.dpatch
+bts542859-df-fix-ignorelist.dpatch
 
diff --git a/debian/patches/bts542859-df-fix-ignorelist.dpatch b/debian/patches/bts542859-df-fix-ignorelist.dpatch
new file mode 100755 (executable)
index 0000000..8a55f8c
--- /dev/null
@@ -0,0 +1,56 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## bts542859-df-fix-ignorelist.dpatch by Florian Forster <octo@verplant.org>
+##
+## DP: df plugin: Check ignorelists before stat'ing the filesystem.
+
+@DPATCH@
+
+diff a/src/df.c b/src/df.c
+--- 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);
+       }