diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-12-30 19:48:17 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-12-30 19:58:06 +0100 |
commit | d8d6b2275f7b7a5b58c6b0d89b78c927333c6af9 (patch) | |
tree | 63f1d579f01ec0677bb2710938166ba5e440bd06 /src/basic/hostname-util.c | |
parent | nss-systemd: fix required buffer size calculation (diff) | |
download | systemd-d8d6b2275f7b7a5b58c6b0d89b78c927333c6af9.tar.xz systemd-d8d6b2275f7b7a5b58c6b0d89b78c927333c6af9.zip |
hostname-setup: gracefully handle kernel with empty CONFIG_DEFAULT_HOSTNAME
Previously, sethostname_idempotent_full() calls gethostname_full() with
GET_HOSTNAME_ALLOW_NONE and GET_HOSTNAME_ALLOW_LOCALHOST flags. That
intended to get any values set by kernel. But, that does not work, as
the hostname may be empty.
Let's simplify the logic. The function sethostname_idempotent_full()
intends to set the requested hostname only when the current hostname
is different from the requested one. So, no check in getostname_full()
is required. Hence, simply use the result of uname() here.
Fixes #21896.
Diffstat (limited to 'src/basic/hostname-util.c')
0 files changed, 0 insertions, 0 deletions