1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-11 05:17:44 +03:00

resolve: fix assertion triggered when r == 0

Fixes #22178.
This commit is contained in:
Yu Watanabe 2022-01-20 05:24:31 +09:00
parent acac88340a
commit 98b1eb711c

View File

@ -109,7 +109,10 @@ static int parse_line(EtcHosts *hosts, unsigned nr, const char *line) {
r = dns_name_is_valid_ldh(name);
if (r <= 0) {
log_warning_errno(r, "/etc/hosts:%u: hostname \"%s\" is not valid, ignoring.", nr, name);
if (r < 0)
log_warning_errno(r, "/etc/hosts:%u: Failed to check the validity of hostname \"%s\", ignoring: %m", nr, name);
else
log_warning("/etc/hosts:%u: hostname \"%s\" is not valid, ignoring.", nr, name);
continue;
}