1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-23 21:35:11 +03:00

hostnamed: correct variable with errno in fallback_chassis

fixes assertion failure on arm:

systemd-hostnamed[642]: Assertion '(_error) != 0' failed at src/hostname/hostnamed.c:207, function fallback_chassis(). Aborting.
This commit is contained in:
Jan Palus 2021-07-08 00:23:21 +02:00 committed by Lennart Poettering
parent f6278558da
commit 105a4245ff

View File

@ -204,14 +204,14 @@ static const char* fallback_chassis(void) {
r = read_one_line_file("/sys/class/dmi/id/chassis_type", &type); r = read_one_line_file("/sys/class/dmi/id/chassis_type", &type);
if (r < 0) { if (r < 0) {
log_debug_errno(v, "Failed to read DMI chassis type, ignoring: %m"); log_debug_errno(r, "Failed to read DMI chassis type, ignoring: %m");
goto try_acpi; goto try_acpi;
} }
r = safe_atou(type, &t); r = safe_atou(type, &t);
free(type); free(type);
if (r < 0) { if (r < 0) {
log_debug_errno(v, "Failed to parse DMI chassis type, ignoring: %m"); log_debug_errno(r, "Failed to parse DMI chassis type, ignoring: %m");
goto try_acpi; goto try_acpi;
} }
@ -260,14 +260,14 @@ static const char* fallback_chassis(void) {
try_acpi: try_acpi:
r = read_one_line_file("/sys/firmware/acpi/pm_profile", &type); r = read_one_line_file("/sys/firmware/acpi/pm_profile", &type);
if (r < 0) { if (r < 0) {
log_debug_errno(v, "Failed read ACPI PM profile, ignoring: %m"); log_debug_errno(r, "Failed read ACPI PM profile, ignoring: %m");
return NULL; return NULL;
} }
r = safe_atou(type, &t); r = safe_atou(type, &t);
free(type); free(type);
if (r < 0) { if (r < 0) {
log_debug_errno(v, "Failed parse ACPI PM profile, ignoring: %m"); log_debug_errno(r, "Failed parse ACPI PM profile, ignoring: %m");
return NULL; return NULL;
} }