From f5b73a7fa80e97eb75717324af3cda2ca98efa8b Mon Sep 17 00:00:00 2001 From: Susant Sahani Date: Mon, 18 Jan 2021 21:27:25 +0100 Subject: [PATCH] udev-rules: Use ordered_hashmap_ensure_put --- src/udev/udev-rules.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c index c5c2f8cfeac..751623cb15d 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(); + if (r < 0) + return log_rule_error_errno(dev, rules, r, "Failed to store SECLABEL{%s}='%s': %m", name, label);; - r = ordered_hashmap_put(event->seclabel_list, name, label); - if (r < 0) - return log_oom(); log_rule_debug(dev, rules, "SECLABEL{%s}='%s'", name, label); name = label = NULL; break;