summaryrefslogtreecommitdiffstats
path: root/src/udev/udev-rules.c
diff options
context:
space:
mode:
authorSusant Sahani <ssahani@vmware.com>2021-01-18 21:27:25 +0100
committerSusant Sahani <ssahani@vmware.com>2021-01-19 05:56:31 +0100
commitf5b73a7fa80e97eb75717324af3cda2ca98efa8b (patch)
tree44e73b5a8ee9c9fab3df92020f76cbc9ea33f9f5 /src/udev/udev-rules.c
parentsysusers: use ordered_hashmap_ensure_put (diff)
downloadsystemd-f5b73a7fa80e97eb75717324af3cda2ca98efa8b.tar.xz
systemd-f5b73a7fa80e97eb75717324af3cda2ca98efa8b.zip
udev-rules: Use ordered_hashmap_ensure_put
Diffstat (limited to '')
-rw-r--r--src/udev/udev-rules.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index c5c2f8cfea..751623cb15 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -1977,13 +1977,12 @@ static int udev_rule_apply_token_to_event(
if (token->op == OP_ASSIGN)
ordered_hashmap_clear_free_free(event->seclabel_list);
- r = ordered_hashmap_ensure_allocated(&event->seclabel_list, NULL);
- if (r < 0)
+ r = ordered_hashmap_ensure_put(&event->seclabel_list, NULL, name, label);
+ if (r == -ENOMEM)
return log_oom();
-
- r = ordered_hashmap_put(event->seclabel_list, name, label);
if (r < 0)
- return log_oom();
+ return log_rule_error_errno(dev, rules, r, "Failed to store SECLABEL{%s}='%s': %m", name, label);;
+
log_rule_debug(dev, rules, "SECLABEL{%s}='%s'", name, label);
name = label = NULL;
break;