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.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2020-09-08 17:40:46 +02:00
parent 8195283265
commit c413bb28df
6 changed files with 29 additions and 13 deletions
+4 -2
View File
@@ -2086,8 +2086,10 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
if (streq(key, "systemd.unit")) {
if (proc_cmdline_value_missing(key, value))
return 0;
if (!unit_name_is_valid(value, UNIT_NAME_PLAIN|UNIT_NAME_INSTANCE))
return log_warning("Unit name specified on %s= is not valid, ignoring: %s", key, value);
if (!unit_name_is_valid(value, UNIT_NAME_PLAIN|UNIT_NAME_INSTANCE)) {
log_warning("Unit name specified on %s= is not valid, ignoring: %s", key, value);
return 0;
}
return free_and_strdup_warn(ret, key);