diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-02-16 23:53:44 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2016-02-16 23:53:44 +0100 |
commit | 12343facf32d5d4c7945f9768db09fd2a8526cd2 (patch) | |
tree | 9e6035ad571bd87df655f2e82c000d3a7cd8242c /src/libsystemd-network/sd-ndisc.c | |
parent | bd8b65996c2bb2f44453f815fcd2e083827c15a3 (diff) | |
parent | 4edc2c9b6b5b921873eb82e58719ed4d9e0d69bf (diff) |
Merge pull request #2626 from poettering/fionread-fix
networkd: FIONREAD is not reliable on some sockets
Diffstat (limited to 'src/libsystemd-network/sd-ndisc.c')
-rw-r--r-- | src/libsystemd-network/sd-ndisc.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/libsystemd-network/sd-ndisc.c b/src/libsystemd-network/sd-ndisc.c index 519d2aa36b..bae6a49fe6 100644 --- a/src/libsystemd-network/sd-ndisc.c +++ b/src/libsystemd-network/sd-ndisc.c @@ -491,19 +491,16 @@ static int ndisc_router_advertisment_recv(sd_event_source *s, int fd, uint32_t r struct cmsghdr *cmsg; struct in6_addr *gw; unsigned lifetime; - ssize_t len; - int r, pref, stateful, buflen = 0; + ssize_t len, buflen; + int r, pref, stateful; assert(s); assert(nd); assert(nd->event); - r = ioctl(fd, FIONREAD, &buflen); - if (r < 0) - return -errno; - else if (buflen < 0) - /* This really should not happen */ - return -EIO; + buflen = next_datagram_size_fd(fd); + if (buflen < 0) + return buflen; iov.iov_len = buflen; |