summaryrefslogtreecommitdiffstats
path: root/src/basic/hostname-util.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-12-30 19:56:59 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2021-12-30 20:05:38 +0100
commit9383fa08bd263277d9a17a8999c3497458f273e3 (patch)
tree4a49e935e3565bdc4c0ecb63b88f0f92011bf392 /src/basic/hostname-util.c
parenthostname-setup: gracefully handle kernel with empty CONFIG_DEFAULT_HOSTNAME (diff)
downloadsystemd-9383fa08bd263277d9a17a8999c3497458f273e3.tar.xz
systemd-9383fa08bd263277d9a17a8999c3497458f273e3.zip
hostname-util: drop GET_HOSTNAME_ALLOW_NONE flag and always refuse "(none)"
The flag is now only used in test-sysctl-util.c, and it should be replaced with uname(), because of the same reason as the previous commit.
Diffstat (limited to 'src/basic/hostname-util.c')
-rw-r--r--src/basic/hostname-util.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/basic/hostname-util.c b/src/basic/hostname-util.c
index 1d0640e075..136fb3e595 100644
--- a/src/basic/hostname-util.c
+++ b/src/basic/hostname-util.c
@@ -46,8 +46,7 @@ int gethostname_full(GetHostnameFlags flags, char **ret) {
assert_se(uname(&u) >= 0);
s = u.nodename;
- if (isempty(s) ||
- (!FLAGS_SET(flags, GET_HOSTNAME_ALLOW_NONE) && streq(s, "(none)")) ||
+ if (isempty(s) || streq(s, "(none)") ||
(!FLAGS_SET(flags, GET_HOSTNAME_ALLOW_LOCALHOST) && is_localhost(s)) ||
(FLAGS_SET(flags, GET_HOSTNAME_SHORT) && s[0] == '.')) {
if (!FLAGS_SET(flags, GET_HOSTNAME_FALLBACK_DEFAULT))