1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

udev-rules: Use ordered_hashmap_ensure_put

This commit is contained in:
Susant Sahani 2021-01-18 21:27:25 +01:00
parent 1dfb93210f
commit f5b73a7fa8

View File

@ -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;