From 7211c853c26554ad1f58c2cfa1d5a0bfc059bf15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 9 Feb 2021 16:06:36 +0100 Subject: tree-wide: propagate error code from _from_string() functions Now that we know we have something useful, no need to make an answer up. --- src/escape/escape.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/escape') diff --git a/src/escape/escape.c b/src/escape/escape.c index a2fdce790e..3178f9b172 100644 --- a/src/escape/escape.c +++ b/src/escape/escape.c @@ -82,17 +82,16 @@ static int parse_argv(int argc, char *argv[]) { case ARG_VERSION: return version(); - case ARG_SUFFIX: - - if (unit_type_from_string(optarg) < 0) - return log_error_errno(SYNTHETIC_ERRNO(EINVAL), - "Invalid unit suffix type %s.", optarg); + case ARG_SUFFIX: { + UnitType t = unit_type_from_string(optarg); + if (t < 0) + return log_error_errno(t, "Invalid unit suffix type \"%s\".", optarg); arg_suffix = optarg; break; + } case ARG_TEMPLATE: - if (!unit_name_is_valid(optarg, UNIT_NAME_TEMPLATE)) return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Template name %s is not valid.", optarg); -- cgit v1.2.1