wmbattery: avoid truncating ACPI info
Hitherto, the following code has been used to read from ACPI files:
end = read(fd, buf, sizeof(buf));
buf[end - 1] = '\0';
This can cause problems, if we read the whole file and there is no new-line:
$ cat /sys/module/acpi/parameters/acpica_version
20190816$
In this case, the '\0' will overwrite the last digit, leading to spurious
error reports:
ACPI subsystem
2019081 too is old, consider upgrading to
20011018.
Instead, read one fewer byte and write the '\0' at the next index:
end = read(fd, buf, sizeof(buf) - 1);
buf[end] = '\0';
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>