1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-25 01:34:28 +03:00

sd-rtnl: allow sd_rtnl_open_fd() to be used on bound sockets

This commit is contained in:
Tom Gundersen 2015-02-03 21:33:04 +01:00
parent 9c0a72f961
commit 760f409a4a

View File

@ -146,7 +146,8 @@ static int rtnl_open_fd_ap(sd_rtnl **ret, int fd, unsigned n_groups, va_list ap)
addrlen = sizeof(rtnl->sockaddr);
r = bind(fd, &rtnl->sockaddr.sa, addrlen);
if (r < 0)
/* ignore EINVAL to allow opening an already bound socket */
if (r < 0 && errno != EINVAL)
return -errno;
r = getsockname(fd, &rtnl->sockaddr.sa, &addrlen);