summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8627841)
raw | patch | inline | side by side (parent: 8627841)
author | Sebastian Harl <sh@tokkee.org> | |
Tue, 10 Mar 2009 21:06:10 +0000 (22:06 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Tue, 14 Apr 2009 12:43:45 +0000 (14:43 +0200) |
Instead, complain once when the read callback is called for the first time.
src/battery.c | patch | blob | history |
diff --git a/src/battery.c b/src/battery.c
index 416f3397d0e6c01da373ca17dfc8d48fac8ab03a..3e726991c76337421b9d126a886d041bd2a8d372 100644 (file)
--- a/src/battery.c
+++ b/src/battery.c
#include "common.h"
#include "plugin.h"
+#include "utils_complain.h"
+
#if HAVE_MACH_MACH_TYPES_H
# include <mach/mach_types.h>
#endif
/* #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];
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 */