Check if power management file exists first before trying to

access it
This commit is contained in:
twinaphex 2016-05-14 15:59:22 +02:00
parent 8b9cabf41d
commit 2ea009d301
1 changed files with 2 additions and 0 deletions

View File

@ -811,6 +811,8 @@ static void check_proc_acpi_sysfs_ac_adapter(const char * node, bool *have_ac)
const char *base = proc_acpi_sysfs_ac_adapter_path;
snprintf(path, sizeof(path), "%s/%s", base, "online");
if (!path_file_exists(path))
return;
if (filestream_read_file(path, (void**)&buf, &length) != 1)
return;