Merge branch 'kate/wip/fix-set-gerrer' into 'master'

linux: up-device-supply-battery: Fix assigning an error to a non-NULL GError pointer

Closes #331

See merge request upower/upower!295
This commit is contained in:
Kate Hsuan 2025-12-12 22:37:45 +08:00
commit e880aa11a5

View file

@ -711,9 +711,8 @@ up_device_supply_battery_set_battery_charge_thresholds(UpDevice *device, guint s
if (start != G_MAXUINT) { if (start != G_MAXUINT) {
g_string_printf (start_str, "%d", CLAMP (start, 0, 100)); g_string_printf (start_str, "%d", CLAMP (start, 0, 100));
if (!g_file_set_contents_full (start_filename, start_str->str, start_str->len, if (!g_file_set_contents_full (start_filename, start_str->str, start_str->len,
G_FILE_SET_CONTENTS_ONLY_EXISTING, 0644, error)) { G_FILE_SET_CONTENTS_ONLY_EXISTING, 0644, NULL))
err_count++; err_count++;
}
} else { } else {
g_debug ("Ignore charge_control_start_threshold setting"); g_debug ("Ignore charge_control_start_threshold setting");
} }
@ -721,9 +720,8 @@ up_device_supply_battery_set_battery_charge_thresholds(UpDevice *device, guint s
if (end != G_MAXUINT) { if (end != G_MAXUINT) {
g_string_printf (end_str, "%d", CLAMP (end, 0, 100)); g_string_printf (end_str, "%d", CLAMP (end, 0, 100));
if (!g_file_set_contents_full (end_filename, end_str->str, end_str->len, if (!g_file_set_contents_full (end_filename, end_str->str, end_str->len,
G_FILE_SET_CONTENTS_ONLY_EXISTING, 0644, error)) { G_FILE_SET_CONTENTS_ONLY_EXISTING, 0644, NULL))
err_count++; err_count++;
}
} else { } else {
g_debug ("Ignore charge_control_end_threshold setting"); g_debug ("Ignore charge_control_end_threshold setting");
} }