network: Use hashmap_ensure_put
This commit is contained in:
@@ -805,11 +805,9 @@ int config_parse_stacked_netdev(const char *unit,
|
||||
if (!name)
|
||||
return log_oom();
|
||||
|
||||
r = hashmap_ensure_allocated(h, &string_hash_ops);
|
||||
if (r < 0)
|
||||
r = hashmap_ensure_put(h, &string_hash_ops, name, INT_TO_PTR(kind));
|
||||
if (r == -ENOMEM)
|
||||
return log_oom();
|
||||
|
||||
r = hashmap_put(*h, name, INT_TO_PTR(kind));
|
||||
if (r < 0)
|
||||
log_syntax(unit, LOG_WARNING, filename, line, r,
|
||||
"Cannot add NetDev '%s' to network, ignoring assignment: %m", name);
|
||||
|
||||
Reference in New Issue
Block a user