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];
|
||||
int acpi_ver = 0;
|
||||
int retval;
|
||||
size_t buflen;
|
||||
unsigned int version_offset = 0;
|
||||
|
||||
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 */
|
||||
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);
|
||||
pinfo("ACPI version detected: %d\n", acpi_ver);
|
||||
if (acpi_ver < 20020214) {
|
||||
|
@ -431,7 +436,10 @@ static power_state_t procfs_get_power_status(global_t *globals)
|
|||
return PS_ERR;
|
||||
}
|
||||
|
||||
fgets(buf, 1024, file);
|
||||
if (!fgets(buf, 1024, file)) {
|
||||
pfatal("Could not read file\n");
|
||||
return PS_ERR;
|
||||
}
|
||||
fclose(file);
|
||||
val = get_value(buf);
|
||||
if ((strncmp(val, "on-line", 7)) == 0)
|
||||
|
|
Loading…
Reference in a new issue