From 9f0454a833c3a0894d5f18154f0fbd5ef713af07 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 27 Feb 2018 17:46:00 +0100 Subject: [PATCH] resolve-tool: propagate sensible errors from due to dns_name_is_valid() check failures --- src/resolve/resolve-tool.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/resolve/resolve-tool.c b/src/resolve/resolve-tool.c index 0b446a341ba..d4aac244be9 100644 --- a/src/resolve/resolve-tool.c +++ b/src/resolve/resolve-tool.c @@ -2131,8 +2131,10 @@ static int parse_argv(int argc, char *argv[]) { r = dns_name_is_valid(p); if (r < 0) return log_error_errno(r, "Failed to validate specified domain %s: %m", p); - if (r == 0) - return log_error_errno(r, "Domain not valid: %s", p); + if (r == 0) { + log_error("Domain not valid: %s", p); + return -EINVAL; + } r = strv_extend(&arg_set_domain, optarg); if (r < 0) @@ -2170,8 +2172,10 @@ static int parse_argv(int argc, char *argv[]) { r = dns_name_is_valid(optarg); if (r < 0) return log_error_errno(r, "Failed to validate specified domain %s: %m", optarg); - if (r == 0) - return log_error_errno(r, "Domain not valid: %s", optarg); + if (r == 0) { + log_error("Domain not valid: %s", optarg); + return -EINVAL; + } r = strv_extend(&arg_set_nta, optarg); if (r < 0)