summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-02-03 21:33:04 +0100
committerTom Gundersen <teg@jklm.no>2015-02-03 22:20:38 +0100
commit760f409a4add18e1b6ca773c2ccab01162885b9f (patch)
treeab77756038aaab12a1deab521b0681daf6ea1e56 /src
parent9c0a72f961e00b0447767973e7117e131bea5b5d (diff)
sd-rtnl: allow sd_rtnl_open_fd() to be used on bound sockets
Diffstat (limited to 'src')
-rw-r--r--src/libsystemd/sd-rtnl/sd-rtnl.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libsystemd/sd-rtnl/sd-rtnl.c b/src/libsystemd/sd-rtnl/sd-rtnl.c
index 45ba50a856..ae49c77e01 100644
--- a/src/libsystemd/sd-rtnl/sd-rtnl.c
+++ b/src/libsystemd/sd-rtnl/sd-rtnl.c
@@ -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);