network: online - use hashmap_ensure_put

This commit is contained in:
Susant Sahani
2021-01-15 14:32:16 +01:00
committed by Susant Sahani
parent 7a0c0e0e41
commit 4f38ba3889
+2 -4
View File
@@ -83,11 +83,9 @@ static int parse_interface_with_operstate_range(const char *str) {
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"Invalid interface name '%s'", ifname);
r = hashmap_ensure_allocated(&arg_interfaces, &string_hash_ops);
if (r < 0)
r = hashmap_ensure_put(&arg_interfaces, &string_hash_ops, ifname, TAKE_PTR(range));
if (r == -ENOMEM)
return log_oom();
r = hashmap_put(arg_interfaces, ifname, TAKE_PTR(range));
if (r < 0)
return log_error_errno(r, "Failed to store interface name: %m");
if (r == 0)