diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-03-13 08:12:55 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-03-13 16:39:10 +0100 |
commit | 6e4571f0c2187ac8e9c601f189e2a6504d801557 (patch) | |
tree | 78833eef7bd443e09da8d03d2030021abbc08487 /src/network/networkd-link-bus.c | |
parent | ordered-set: make ordered_set_put_strdup() allocate OrderedSet object (diff) | |
download | systemd-6e4571f0c2187ac8e9c601f189e2a6504d801557.tar.xz systemd-6e4571f0c2187ac8e9c601f189e2a6504d801557.zip |
network: use string_hash_ops_free
Diffstat (limited to 'src/network/networkd-link-bus.c')
-rw-r--r-- | src/network/networkd-link-bus.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/network/networkd-link-bus.c b/src/network/networkd-link-bus.c index f57828b57d..4d0e4815db 100644 --- a/src/network/networkd-link-bus.c +++ b/src/network/networkd-link-bus.c @@ -178,7 +178,7 @@ int bus_link_method_set_dns_servers_ex(sd_bus_message *message, void *userdata, } int bus_link_method_set_domains(sd_bus_message *message, void *userdata, sd_bus_error *error) { - _cleanup_(ordered_set_freep) OrderedSet *search_domains = NULL, *route_domains = NULL; + _cleanup_ordered_set_free_ OrderedSet *search_domains = NULL, *route_domains = NULL; Link *l = userdata; int r; @@ -218,15 +218,15 @@ int bus_link_method_set_domains(sd_bus_message *message, void *userdata, sd_bus_ return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid search domain %s", name); domains = route_only ? &route_domains : &search_domains; - r = ordered_set_ensure_allocated(domains, &string_hash_ops); + r = ordered_set_ensure_allocated(domains, &string_hash_ops_free); if (r < 0) return r; - r = ordered_set_put(*domains, str); + r = ordered_set_consume(*domains, TAKE_PTR(str)); + if (r == -EEXIST) + continue; if (r < 0) return r; - - TAKE_PTR(str); } r = sd_bus_message_exit_container(message); @@ -242,8 +242,8 @@ int bus_link_method_set_domains(sd_bus_message *message, void *userdata, sd_bus_ if (r == 0) return 1; /* Polkit will call us back */ - ordered_set_free_free(l->search_domains); - ordered_set_free_free(l->route_domains); + ordered_set_free(l->search_domains); + ordered_set_free(l->route_domains); l->search_domains = TAKE_PTR(search_domains); l->route_domains = TAKE_PTR(route_domains); |