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:
parent
fabab19068
commit
5c60db874d
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user