network: online - use hashmap_ensure_put
This commit is contained in:
committed by
Susant Sahani
parent
7a0c0e0e41
commit
4f38ba3889
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user