summaryrefslogtreecommitdiff
path: root/src/network/networkd-dhcp-common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/networkd-dhcp-common.c')
-rw-r--r--src/network/networkd-dhcp-common.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
index 606ae9f3c2..5b1acde297 100644
--- a/src/network/networkd-dhcp-common.c
+++ b/src/network/networkd-dhcp-common.c
@@ -664,17 +664,8 @@ int config_parse_dhcp_request_options(
continue;
}
- if (ltype == AF_INET)
- r = set_ensure_allocated(&network->dhcp_request_options, NULL);
- else
- r = set_ensure_allocated(&network->dhcp6_request_options, NULL);
- if (r < 0)
- return log_oom();
-
- if (ltype == AF_INET)
- r = set_put(network->dhcp_request_options, UINT32_TO_PTR(i));
- else
- r = set_put(network->dhcp6_request_options, UINT32_TO_PTR(i));
+ r = set_ensure_put(ltype == AF_INET ? &network->dhcp_request_options : &network->dhcp6_request_options,
+ NULL, UINT32_TO_PTR(i));
if (r < 0)
log_syntax(unit, LOG_ERR, filename, line, r,
"Failed to store DHCP request option '%s', ignoring assignment: %m", n);