platform-profile: Fix crash if kernel built w/o platform_profile

If the kernel is built with platform_profile support,
g_file_get_contents() will fail, and we'll likely crash trying to
access ->message in the struct.

Don't forget to pass the error to g_file_get_contents().
This commit is contained in:
Luca Stefani 2021-04-08 12:13:22 +02:00 committed by Bastien Nocera
parent 24755fec0a
commit 3b0f72989b

View file

@ -101,7 +101,7 @@ read_platform_profile (void)
platform_profile_path = ppd_utils_get_sysfs_path (ACPI_PLATFORM_PROFILE_PATH);
if (!g_file_get_contents (platform_profile_path,
&new_profile_str, NULL, NULL)) {
&new_profile_str, NULL, &error)) {
g_debug ("Failed to get contents for '%s': %s",
platform_profile_path,
error->message);