From: Sebastian Harl Date: Tue, 14 Apr 2009 13:32:45 +0000 (+0200) Subject: patches: Added battery_acpi_complain.dpatch. X-Git-Tag: collectd-4.6.2-2~15 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=beab0a5acd53d5c6ceb2c184b54c1e06a3349f91;p=pkg-collectd.git patches: Added battery_acpi_complain.dpatch. 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. --- diff --git a/debian/changelog b/debian/changelog index 248cb55..c60df68 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +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 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 332b35c..aa14973 100644 --- a/debian/patches/00list +++ b/debian/patches/00list @@ -1,3 +1,4 @@ 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 new file mode 100755 index 0000000..7ed6042 --- /dev/null +++ b/debian/patches/battery_acpi_complain.dpatch @@ -0,0 +1,50 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## battery_acpi_complain.dpatch by Sebastian Harl +## +## 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 + #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 */ +