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/resolve/resolved-manager.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/resolve/resolved-manager.c')
-rw-r--r-- | src/resolve/resolved-manager.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/resolve/resolved-manager.c b/src/resolve/resolved-manager.c index bf5efe4cfa..7f9073448a 100644 --- a/src/resolve/resolved-manager.c +++ b/src/resolve/resolved-manager.c @@ -617,18 +617,16 @@ int manager_recv(Manager *m, int fd, DnsProtocol protocol, DnsPacket **ret) { struct msghdr mh = {}; struct cmsghdr *cmsg; struct iovec iov; - int ms = 0, r; - ssize_t l; + ssize_t ms, l; + int r; assert(m); assert(fd >= 0); assert(ret); - r = ioctl(fd, FIONREAD, &ms); - if (r < 0) - return -errno; + ms = next_datagram_size_fd(fd); if (ms < 0) - return -EIO; + return ms; r = dns_packet_new(&p, protocol, ms); if (r < 0) |