summaryrefslogtreecommitdiffstats
path: root/src/hostname
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2024-03-04 13:04:20 +0100
committerLennart Poettering <lennart@poettering.net>2024-03-04 13:05:39 +0100
commitd8b4a2463f6c71d736150b7784a7a877958109c5 (patch)
treee2dade8814d225ba9c1526ada3a7c0c9a3cb0d5c /src/hostname
parenthostnamectl: properly initialize the two timestamp fields before doing bus call (diff)
downloadsystemd-d8b4a2463f6c71d736150b7784a7a877958109c5.tar.xz
systemd-d8b4a2463f6c71d736150b7784a7a877958109c5.zip
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 171ddae1a122e9c97b4ef12ccb2d29e1ba7a318a, but let's handle this gracefully in hostnamectl.
Diffstat (limited to 'src/hostname')
-rw-r--r--src/hostname/hostnamectl.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/hostname/hostnamectl.c b/src/hostname/hostnamectl.c
index 5e1cbd373d..d1c4d476f6 100644
--- a/src/hostname/hostnamectl.c
+++ b/src/hostname/hostnamectl.c
@@ -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);