network/route-metric: invalidate [Route] section if an invalid string is specified

Follow-up for 18c4c5d84f.
This commit is contained in:
Yu Watanabe
2024-01-07 14:04:00 +09:00
parent 5e124de7e6
commit 9aa3c07947
2 changed files with 9 additions and 7 deletions
+2 -5
View File
@@ -435,15 +435,12 @@ int config_parse_route_metric_tcp_congestion(
void *data,
void *userdata) {
Network *network = userdata;
Network *network = ASSERT_PTR(userdata);
_cleanup_(route_free_or_set_invalidp) Route *route = NULL;
int r;
assert(filename);
assert(section);
assert(lvalue);
assert(rvalue);
assert(data);
r = route_new_static(network, filename, section_line, &route);
if (r == -ENOMEM)
@@ -456,7 +453,7 @@ int config_parse_route_metric_tcp_congestion(
r = config_parse_string(unit, filename, line, section, section_line, lvalue, 0,
rvalue, &route->metric.tcp_congestion_control_algo, userdata);
if (r < 0)
if (r <= 0)
return r;
TAKE_PTR(route);