1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-26 10:03:40 +03:00

Merge pull request #13302 from yuwata/network-set-put-fixes

network: fixes related to set_put()
This commit is contained in:
Lennart Poettering 2019-08-14 16:18:06 +02:00 committed by GitHub
commit 24f36fb180
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 3 deletions

View File

@ -260,6 +260,8 @@ static int address_add_internal(Link *link, Set **addresses,
r = set_put(*addresses, address);
if (r < 0)
return r;
if (r == 0)
return -EEXIST;
address->link = link;

View File

@ -1948,6 +1948,8 @@ static int link_append_to_master(Link *link, NetDev *netdev) {
r = set_put(master->slaves, link);
if (r < 0)
return r;
if (r == 0)
return 0;
link_ref(link);
return 0;
@ -2725,6 +2727,8 @@ int get_product_uuid_handler(sd_bus_message *m, void *userdata, sd_bus_error *re
configure:
while ((link = set_steal_first(manager->links_requesting_uuid))) {
link_unref(link);
r = link_configure(link);
if (r < 0)
link_enter_failed(link);
@ -2797,6 +2801,8 @@ static int link_configure_duid(Link *link) {
r = set_put(m->duids_requesting_uuid, duid);
if (r < 0)
return log_oom();
link_ref(link);
}
return 0;

View File

@ -2039,6 +2039,8 @@ int manager_request_product_uuid(Manager *m, Link *link) {
r = set_put(m->duids_requesting_uuid, duid);
if (r < 0)
return log_oom();
link_ref(link);
}
if (!m->bus || sd_bus_is_ready(m->bus) <= 0) {

View File

@ -399,6 +399,8 @@ static int route_add_internal(
r = set_put(*routes, route);
if (r < 0)
return r;
if (r == 0)
return -EEXIST;
route->link = link;

View File

@ -209,7 +209,11 @@ int routing_policy_rule_make_local(Manager *m, RoutingPolicyRule *rule) {
if (r < 0)
return r;
return set_put(m->rules, rule);
r = set_put(m->rules, rule);
if (r < 0)
return r;
if (r == 0)
routing_policy_rule_free(rule);
}
return -ENOENT;
@ -265,6 +269,8 @@ static int routing_policy_rule_add_internal(Manager *m, Set **rules, RoutingPoli
r = set_put(*rules, rule);
if (r < 0)
return r;
if (r == 0)
return -EEXIST;
if (ret)
*ret = rule;
@ -1180,8 +1186,8 @@ int routing_policy_load_rules(const char *state_file, Set **rules) {
log_warning_errno(r, "Failed to add RPDB rule to saved DB, ignoring: %s", p);
continue;
}
rule = NULL;
if (r > 0)
rule = NULL;
}
return 0;