summaryrefslogtreecommitdiff
path: root/src/resolve
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2022-12-07 22:55:37 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2022-12-13 20:29:16 +0900
commit10b0c81802541373c576b63e16500b87e0eacaaf (patch)
treed455244ea5c1c82d06b568b76f33b0587c2e63ef /src/resolve
parent9f1a1f2047bc6cad9cd03a3535b15a84b2c68b9e (diff)
downloadsystemd-10b0c81802541373c576b63e16500b87e0eacaaf.tar.gz
resolve: adjust warning
Diffstat (limited to 'src/resolve')
-rw-r--r--src/resolve/resolved-etc-hosts.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/resolve/resolved-etc-hosts.c b/src/resolve/resolved-etc-hosts.c
index 547c5fe17d..4e74610bff 100644
--- a/src/resolve/resolved-etc-hosts.c
+++ b/src/resolve/resolved-etc-hosts.c
@@ -115,8 +115,6 @@ static int parse_line(EtcHosts *hosts, unsigned nr, const char *line) {
if (r == 0)
break;
- found = true;
-
r = dns_name_is_valid_ldh(name);
if (r <= 0) {
if (r < 0)
@@ -126,13 +124,15 @@ static int parse_line(EtcHosts *hosts, unsigned nr, const char *line) {
continue;
}
+ found = true;
+
if (!item) {
/* Optimize the case where we don't need to store any addresses, by storing
* only the name in a dedicated Set instead of the hashmap */
r = set_ensure_consume(&hosts->no_address, &dns_name_hash_ops, TAKE_PTR(name));
if (r < 0)
- return r;
+ return log_oom();
continue;
}
@@ -167,7 +167,7 @@ static int parse_line(EtcHosts *hosts, unsigned nr, const char *line) {
}
if (!found)
- log_warning("/etc/hosts:%u: line is missing any hostnames", nr);
+ log_warning("/etc/hosts:%u: line is missing any valid hostnames", nr);
return 0;
}