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);