1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-08 21:17:47 +03:00

sd-netlink: don't take possesion of netlink fd from caller on failure

Fixes: #2338
This commit is contained in:
Lennart Poettering 2016-02-01 22:13:45 +01:00
parent fabab19068
commit 5c60db874d

View File

@ -118,8 +118,10 @@ int sd_netlink_open_fd(sd_netlink **ret, int fd) {
rtnl->fd = fd;
r = socket_bind(rtnl);
if (r < 0)
if (r < 0) {
rtnl->fd = -1; /* on failure, the caller remains owner of the fd, hence don't close it here */
return r;
}
*ret = rtnl;
rtnl = NULL;