summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSusant Sahani <ssahani@vmware.com>2021-01-15 14:32:16 +0100
committerSusant Sahani <ssahani@gmail.com>2021-01-15 14:32:16 +0100
commit4f38ba3889a6ac82f28e365599c613c5c5e87502 (patch)
tree6dbec2ce7c5f14a6d2d10e36c8d67ccdd9c0f263
parent7a0c0e0e41142db49ff6c69c93bb1cba737249c5 (diff)
downloadsystemd-4f38ba3889a6ac82f28e365599c613c5c5e87502.tar.gz
network: online - use hashmap_ensure_put
-rw-r--r--src/network/wait-online/wait-online.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/network/wait-online/wait-online.c b/src/network/wait-online/wait-online.c
index c2bdcd4907..d6716e1874 100644
--- a/src/network/wait-online/wait-online.c
+++ b/src/network/wait-online/wait-online.c
@@ -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)