summaryrefslogtreecommitdiff
path: root/src/sysctl
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2022-08-17 14:29:26 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2022-08-17 14:30:20 +0900
commit350ffa9749f2ce5d62e4b66cc7418e25e6829963 (patch)
treec9423fa39652ba4af0a1ef065b19837cf278e75c /src/sysctl
parentb1358f03627210d4aab08afd8d9d3208d0404405 (diff)
downloadsystemd-350ffa9749f2ce5d62e4b66cc7418e25e6829963.tar.gz
sysctl: use ordered_hashmap_ensure_put()
Diffstat (limited to 'src/sysctl')
-rw-r--r--src/sysctl/sysctl.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/sysctl/sysctl.c b/src/sysctl/sysctl.c
index de0e03ec95..dda112f45a 100644
--- a/src/sysctl/sysctl.c
+++ b/src/sysctl/sysctl.c
@@ -254,9 +254,6 @@ static int parse_file(OrderedHashmap **sysctl_options, const char *path, bool ig
!test_prefix(p))
continue;
- if (ordered_hashmap_ensure_allocated(sysctl_options, &option_hash_ops) < 0)
- return log_oom();
-
existing = ordered_hashmap_get(*sysctl_options, p);
if (existing) {
if (streq_ptr(value, existing->value)) {
@@ -272,7 +269,7 @@ static int parse_file(OrderedHashmap **sysctl_options, const char *path, bool ig
if (!new_option)
return log_oom();
- k = ordered_hashmap_put(*sysctl_options, new_option->key, new_option);
+ k = ordered_hashmap_ensure_put(sysctl_options, &option_hash_ops, new_option->key, new_option);
if (k < 0)
return log_error_errno(k, "Failed to add sysctl variable %s to hashmap: %m", p);