projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
collectd-tg: Fix unintentional cast from double to time_t.
[collectd.git]
/
src
/
battery.c
diff --git
a/src/battery.c
b/src/battery.c
index
f106da0
..
c4c050d
100644
(file)
--- a/
src/battery.c
+++ b/
src/battery.c
@@
-416,10
+416,13
@@
static int sysfs_file_to_buffer(char const *dir, /* {{{ */
if (fgets (buffer, buffer_size, fp) == NULL)
{
if (fgets (buffer, buffer_size, fp) == NULL)
{
- char errbuf[1024];
status = errno;
status = errno;
- WARNING ("battery plugin: fgets failed: %s",
- sstrerror (status, errbuf, sizeof (errbuf)));
+ if (status != ENODEV)
+ {
+ char errbuf[1024];
+ WARNING ("battery plugin: fgets (%s) failed: %s", filename,
+ sstrerror (status, errbuf, sizeof (errbuf)));
+ }
fclose (fp);
return status;
}
fclose (fp);
return status;
}
@@
-553,7
+556,7
@@
static int read_acpi_full_capacity (char const *dir, /* {{{ */
ssnprintf (filename, sizeof (filename), "%s/%s/info", dir, power_supply);
fh = fopen (filename, "r");
ssnprintf (filename, sizeof (filename), "%s/%s/info", dir, power_supply);
fh = fopen (filename, "r");
- if (
(fh = fopen (filename, "r"))
== NULL)
+ if (
fh
== NULL)
return (errno);
/* last full capacity: 40090 mWh */
return (errno);
/* last full capacity: 40090 mWh */
@@
-612,7
+615,7
@@
static int read_acpi_callback (char const *dir, /* {{{ */
ssnprintf (filename, sizeof (filename), "%s/%s/state", dir, power_supply);
fh = fopen (filename, "r");
ssnprintf (filename, sizeof (filename), "%s/%s/state", dir, power_supply);
fh = fopen (filename, "r");
- if (
(fh = fopen (filename, "r"))
== NULL)
+ if (
fh
== NULL)
{
if ((errno == EAGAIN) || (errno == EINTR) || (errno == ENOENT))
return (0);
{
if ((errno == EAGAIN) || (errno == EINTR) || (errno == ENOENT))
return (0);