summaryrefslogtreecommitdiff
path: root/src/escape
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-02-09 16:06:36 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-02-10 14:46:59 +0100
commit7211c853c26554ad1f58c2cfa1d5a0bfc059bf15 (patch)
tree8ec5ffd55875cf64df5df97d7cf10c6449d23fea /src/escape
parent751db3b4cd09ba7f9352444b93600992493cbf28 (diff)
downloadsystemd-7211c853c26554ad1f58c2cfa1d5a0bfc059bf15.tar.gz
tree-wide: propagate error code from _from_string() functions
Now that we know we have something useful, no need to make an answer up.
Diffstat (limited to 'src/escape')
-rw-r--r--src/escape/escape.c11
1 files changed, 5 insertions, 6 deletions
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);