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:18:16 +01:00
parent fabab19068
commit 5c60db874d
+3 -1
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;