tree-wide: use error codes in xxx_from_string()

This commit is contained in:
Yu Watanabe
2021-02-12 01:17:13 +09:00
parent 0cbb768aba
commit b98680b2b8
12 changed files with 36 additions and 29 deletions
+3 -3
View File
@@ -874,7 +874,7 @@ int config_parse_log_facility(
x = log_facility_unshifted_from_string(rvalue);
if (x < 0) {
log_syntax(unit, LOG_WARNING, filename, line, 0, "Failed to parse log facility, ignoring: %s", rvalue);
log_syntax(unit, LOG_WARNING, filename, line, x, "Failed to parse log facility, ignoring: %s", rvalue);
return 0;
}
@@ -904,7 +904,7 @@ int config_parse_log_level(
x = log_level_from_string(rvalue);
if (x < 0) {
log_syntax(unit, LOG_WARNING, filename, line, 0, "Failed to parse log level, ignoring: %s", rvalue);
log_syntax(unit, LOG_WARNING, filename, line, x, "Failed to parse log level, ignoring: %s", rvalue);
return 0;
}
@@ -937,7 +937,7 @@ int config_parse_signal(
r = signal_from_string(rvalue);
if (r <= 0) {
log_syntax(unit, LOG_WARNING, filename, line, 0, "Failed to parse signal name, ignoring: %s", rvalue);
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse signal name, ignoring: %s", rvalue);
return 0;
}
+1 -1
View File
@@ -1092,7 +1092,7 @@ int config_parse_advertise(const char *unit,
/* We reuse the kernel provided enum which does not contain negative value. So, the cast
* below is mandatory. Otherwise, the check below always passes and access an invalid address. */
if ((int) mode < 0) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
log_syntax(unit, LOG_WARNING, filename, line, mode,
"Failed to parse advertise mode, ignoring: %s", w);
continue;
}