summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f663f9e)
raw | patch | inline | side by side (parent: f663f9e)
author | Sebastian Harl <sh@tokkee.org> | |
Tue, 14 Apr 2009 13:32:45 +0000 (15:32 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Tue, 14 Apr 2009 13:33:31 +0000 (15:33 +0200) |
This is an upstream patch to fix excessive error messages in the battery
plugin in case /proc/acpi/battery is not available.
The changelog has been updated to 4.6.2-2.
plugin in case /proc/acpi/battery is not available.
The changelog has been updated to 4.6.2-2.
debian/changelog | patch | blob | history | |
debian/patches/00list | patch | blob | history | |
debian/patches/battery_acpi_complain.dpatch | [new file with mode: 0755] | patch | blob |
diff --git a/debian/changelog b/debian/changelog
index 248cb5572de000b25d02dc4592acdc64ec0dd53e..c60df686e31c4c542100f10b496cfdb00db29b4b 100644 (file)
--- a/debian/changelog
+++ b/debian/changelog
+collectd (4.6.2-2) unstable; urgency=low
+
+ * debian/patches:
+ - Added battery_acpi_complain.dpatch - upstream patch to fix excessive
+ error messages in the battery plugin in case /proc/acpi/battery is not
+ available.
+
+ -- Sebastian Harl <sh@tokkee.org> Tue, 14 Apr 2009 15:30:35 +0200
+
collectd (4.6.2-1) unstable; urgency=low
* New upstream release.
diff --git a/debian/patches/00list b/debian/patches/00list
index 332b35c8333c22b54c6ead8e9d0f6750c3bfbc7f..aa14973a193e91625968cb11cb2fb96ea8fb3d34 100644 (file)
--- a/debian/patches/00list
+++ b/debian/patches/00list
rrd_filter_path.dpatch
collection_conf_path.dpatch
+battery_acpi_complain.dpatch
diff --git a/debian/patches/battery_acpi_complain.dpatch b/debian/patches/battery_acpi_complain.dpatch
--- /dev/null
@@ -0,0 +1,50 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## battery_acpi_complain.dpatch by Sebastian Harl <sh@tokkee.org>
+##
+## DP: battery plugin: Don't complain about missing /proc/acpi/battery each
+## DP: interval. Instead, complain once when the read callback is called for
+## DP: the first time.
+
+@DPATCH@
+
+diff a/src/battery.c b/src/battery.c
+--- a/src/battery.c
++++ b/src/battery.c
+@@ -23,6 +23,8 @@
+ #include "common.h"
+ #include "plugin.h"
+
++#include "utils_complain.h"
++
+ #if HAVE_MACH_MACH_TYPES_H
+ # include <mach/mach_types.h>
+ #endif
+@@ -436,6 +438,8 @@ static int battery_read (void)
+ /* #endif HAVE_IOKIT_IOKITLIB_H || HAVE_IOKIT_PS_IOPOWERSOURCES_H */
+
+ #elif KERNEL_LINUX
++ static c_complain_t acpi_dir_complaint = C_COMPLAIN_INIT_STATIC;
++
+ FILE *fh;
+ char buffer[1024];
+ char filename[256];
+@@ -506,8 +510,17 @@ static int battery_read (void)
+ battery_submit ("0", "voltage", voltage);
+ }
+
+- walk_directory (battery_acpi_dir, battery_read_acpi,
+- /* user_data = */ NULL);
++ if (0 == access (battery_acpi_dir, R_OK))
++ walk_directory (battery_acpi_dir, battery_read_acpi,
++ /* user_data = */ NULL);
++ else
++ {
++ char errbuf[1024];
++ c_complain_once (LOG_WARNING, &acpi_dir_complaint,
++ "battery plugin: Failed to access `%s': %s",
++ battery_acpi_dir,
++ sstrerror (errno, errbuf, sizeof (errbuf)));
++ }
+
+ #endif /* KERNEL_LINUX */
+