X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fbattery.c;h=9b5b82d5650a7fb8487b078545edc87bb934e8b0;hb=5ebc182261321f0781f38d8645bfc7c74353434c;hp=a74e7b6423dc6f6692e496ee3d987ef85f285715;hpb=7c9d772c992647fcba64a96800c146eb9f1647f8;p=collectd.git diff --git a/src/battery.c b/src/battery.c index a74e7b64..9b5b82d5 100644 --- a/src/battery.c +++ b/src/battery.c @@ -25,8 +25,8 @@ #include "collectd.h" -#include "common.h" #include "plugin.h" +#include "utils/common/common.h" #if HAVE_MACH_MACH_TYPES_H #include @@ -336,7 +336,7 @@ static int battery_read(void) /* {{{ */ return 0; } /* }}} int battery_read */ -/* #endif HAVE_IOKIT_IOKITLIB_H || HAVE_IOKIT_PS_IOPOWERSOURCES_H */ + /* #endif HAVE_IOKIT_IOKITLIB_H || HAVE_IOKIT_PS_IOPOWERSOURCES_H */ #elif KERNEL_LINUX /* Reads a file which contains only a number (and optionally a trailing @@ -349,12 +349,10 @@ static int sysfs_file_to_buffer(char const *dir, /* {{{ */ snprintf(filename, sizeof(filename), "%s/%s/%s", dir, power_supply, basename); - status = (int)read_file_contents(filename, buffer, buffer_size - 1); + status = (int)read_text_file_contents(filename, buffer, buffer_size); if (status < 0) return status; - buffer[status] = '\0'; - strstripnewline(buffer); return 0; } /* }}} int sysfs_file_to_buffer */