From: Susant Sahani Date: Sat, 16 Jan 2021 22:10:18 +0000 (+0100) Subject: network: use hashmap_ensure_put X-Git-Tag: v248-rc1~323^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dcd46cc42d99c228d91eadc2a3fc2780b578413d;p=thirdparty%2Fsystemd.git network: use hashmap_ensure_put --- diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c index a74a1e946e5..0920a9d282b 100644 --- a/src/network/networkd-network.c +++ b/src/network/networkd-network.c @@ -142,11 +142,9 @@ static int network_resolve_stacked_netdevs(Network *network) { if (r <= 0) continue; - r = hashmap_ensure_allocated(&network->stacked_netdevs, &string_hash_ops); - if (r < 0) + r = hashmap_ensure_put(&network->stacked_netdevs, &string_hash_ops, netdev->ifname, netdev); + if (r == -ENOMEM) return log_oom(); - - r = hashmap_put(network->stacked_netdevs, netdev->ifname, netdev); if (r < 0) return log_error_errno(r, "%s: Failed to add NetDev '%s' to network: %m", network->filename, (const char *) name);