1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 09:21:26 +03:00

network: dhcp6 - use hashmap_ensure_put

This commit is contained in:
Susant Sahani 2021-01-14 06:30:39 +01:00 committed by Susant Sahani
parent fb8ac4cf3e
commit c75165cade

View File

@ -309,11 +309,9 @@ static int dhcp6_set_pd_route(Link *link, const union in_addr_union *prefix, con
.link = link_ref(link),
};
r = hashmap_ensure_allocated(&link->manager->dhcp6_prefixes, &in6_addr_hash_ops);
if (r < 0)
r = hashmap_ensure_put(&link->manager->dhcp6_prefixes, &in6_addr_hash_ops, &pd->prefix, pd);
if (r == -ENOMEM)
return log_oom();
r = hashmap_put(link->manager->dhcp6_prefixes, &pd->prefix, pd);
if (r < 0)
return log_link_error_errno(link, r, "Failed to store DHCPv6 prefix route at manager: %m");