1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-05 15:21:37 +03:00

sd-netlink: do not require rtnl pointer to be passed

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2020-01-10 16:32:27 +01:00
parent 231d9de1e3
commit bad7cecc0a

View File

@ -168,12 +168,14 @@ int rtnl_set_link_alternative_names_by_ifname(sd_netlink **rtnl, const char *ifn
} }
int rtnl_resolve_link_alternative_name(sd_netlink **rtnl, const char *name) { int rtnl_resolve_link_alternative_name(sd_netlink **rtnl, const char *name) {
_cleanup_(sd_netlink_unrefp) sd_netlink *our_rtnl = NULL;
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *message = NULL, *reply = NULL; _cleanup_(sd_netlink_message_unrefp) sd_netlink_message *message = NULL, *reply = NULL;
int r, ret; int r, ret;
assert(rtnl);
assert(name); assert(name);
if (!rtnl)
rtnl = &our_rtnl;
if (!*rtnl) { if (!*rtnl) {
r = sd_netlink_open(rtnl); r = sd_netlink_open(rtnl);
if (r < 0) if (r < 0)