1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-02-08 05:57:26 +03:00

sd-netlink: since whe acquire the netlink socket's sockaddr anyway, let's actually verify it

This commit is contained in:
Lennart Poettering 2016-02-01 22:17:35 +01:00
parent 5c60db874d
commit d6c16624bf

View File

@ -44,11 +44,8 @@ static int sd_netlink_new(sd_netlink **ret) {
return -ENOMEM;
rtnl->n_ref = REFCNT_INIT;
rtnl->fd = -1;
rtnl->sockaddr.nl.nl_family = AF_NETLINK;
rtnl->original_pid = getpid();
LIST_HEAD_INIT(rtnl->match_callbacks);
@ -87,6 +84,9 @@ int sd_netlink_new_from_netlink(sd_netlink **ret, int fd) {
if (r < 0)
return -errno;
if (rtnl->sockaddr.nl.nl_family != AF_NETLINK)
return -EINVAL;
rtnl->fd = fd;
*ret = rtnl;