1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-25 01:34:28 +03:00

hostnamectl: gracefully handle old hostnamed replies to GetHardwareSerial()

Old versions of hostnamed used to propagate ENODEV/ENOENT as-is. Bad
idea. This was fixed in 171ddae1a1, but
let's handle this gracefully in hostnamectl.
This commit is contained in:
Lennart Poettering 2024-03-04 13:04:20 +01:00
parent 67648678b0
commit d8b4a2463f

View File

@ -454,7 +454,8 @@ static int show_all_names(sd_bus *bus) {
&error,
BUS_ERROR_NO_HARDWARE_SERIAL,
SD_BUS_ERROR_INTERACTIVE_AUTHORIZATION_REQUIRED,
SD_BUS_ERROR_UNKNOWN_METHOD) ? LOG_DEBUG : LOG_WARNING,
SD_BUS_ERROR_UNKNOWN_METHOD) ||
ERRNO_IS_DEVICE_ABSENT(r) ? LOG_DEBUG : LOG_WARNING, /* old hostnamed used to send ENOENT/ENODEV back to client as is, handle that gracefully */
r, "Failed to query hardware serial, ignoring: %s", bus_error_message(&error, r));
else {
r = sd_bus_message_read_basic(hardware_serial_reply, 's', &info.hardware_serial);