diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-09-08 12:51:23 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-09-08 17:40:46 +0200 |
commit | c413bb28df0996be99fd6b3f2335dfe8739d62fb (patch) | |
tree | 471627329fda37ea052d798907e079792df541fb /src/escape/escape.c | |
parent | 819528326571f3d5e7fccaf5bc72be6ca00ae78a (diff) | |
download | systemd-c413bb28df0996be99fd6b3f2335dfe8739d62fb.tar.gz |
tree-wide: correct cases where return log_{error,warning} is used without value
In various cases, we would say 'return log_warning()' or 'return log_error()'. Those
functions return 0 if no error is passed in. For log_warning or log_error this doesn't
make sense, and we generally want to propagate the error. In the few cases where
the error should be ignored, I think it's better to split it in two, and call 'return 0'
on a separate line.
Diffstat (limited to 'src/escape/escape.c')
-rw-r--r-- | src/escape/escape.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/escape/escape.c b/src/escape/escape.c index 0c543a90f6..3f3dc0a894 100644 --- a/src/escape/escape.c +++ b/src/escape/escape.c @@ -211,14 +211,16 @@ static int run(int argc, char *argv[]) { if (r < 0) return log_error_errno(r, "Failed to extract instance: %m"); if (isempty(name)) - return log_error("Unit %s is missing the instance name.", *i); + return log_error_errno(SYNTHETIC_ERRNO(EINVAL), + "Unit %s is missing the instance name.", *i); r = unit_name_template(*i, &template); if (r < 0) return log_error_errno(r, "Failed to extract template: %m"); if (arg_template && !streq(arg_template, template)) - return log_error("Unit %s template %s does not match specified template %s.", - *i, template, arg_template); + return log_error_errno(SYNTHETIC_ERRNO(EINVAL), + "Unit %s template %s does not match specified template %s.", + *i, template, arg_template); } else { name = strdup(*i); if (!name) |