wmacpi: Fix -Wunused-result compiler warnings.
In particular, libacpi.c: In function ‘power_init’: libacpi.c:339:5: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result] fread(buf, 4096, 1, acpi); ^ libacpi.c: In function ‘procfs_get_power_status’: libacpi.c:434:5: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result] fgets(buf, 1024, file); ^
This commit is contained in:
parent
dde6a84b93
commit
8530ba751d
|
@ -324,6 +324,7 @@ int power_init(global_t *globals)
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
int acpi_ver = 0;
|
int acpi_ver = 0;
|
||||||
int retval;
|
int retval;
|
||||||
|
size_t buflen;
|
||||||
unsigned int version_offset = 0;
|
unsigned int version_offset = 0;
|
||||||
|
|
||||||
if (!(acpi = fopen("/sys/module/acpi/parameters/acpica_version", "r"))) {
|
if (!(acpi = fopen("/sys/module/acpi/parameters/acpica_version", "r"))) {
|
||||||
|
@ -336,7 +337,11 @@ int power_init(global_t *globals)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* okay, now see if we got the right version */
|
/* okay, now see if we got the right version */
|
||||||
fread(buf, 4096, 1, acpi);
|
buflen = fread(buf, 4096, 1, acpi);
|
||||||
|
if (buflen != 4096 && ferror(acpi)) {
|
||||||
|
pfatal("Could not read file\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
acpi_ver = strtol(buf + version_offset, NULL, 10);
|
acpi_ver = strtol(buf + version_offset, NULL, 10);
|
||||||
pinfo("ACPI version detected: %d\n", acpi_ver);
|
pinfo("ACPI version detected: %d\n", acpi_ver);
|
||||||
if (acpi_ver < 20020214) {
|
if (acpi_ver < 20020214) {
|
||||||
|
@ -431,7 +436,10 @@ static power_state_t procfs_get_power_status(global_t *globals)
|
||||||
return PS_ERR;
|
return PS_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
fgets(buf, 1024, file);
|
if (!fgets(buf, 1024, file)) {
|
||||||
|
pfatal("Could not read file\n");
|
||||||
|
return PS_ERR;
|
||||||
|
}
|
||||||
fclose(file);
|
fclose(file);
|
||||||
val = get_value(buf);
|
val = get_value(buf);
|
||||||
if ((strncmp(val, "on-line", 7)) == 0)
|
if ((strncmp(val, "on-line", 7)) == 0)
|
||||||
|
|
Loading…
Reference in a new issue