summaryrefslogtreecommitdiff
path: root/src/resolve
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-02-15 22:50:01 +0100
committerLennart Poettering <lennart@poettering.net>2016-02-16 13:06:55 +0100
commit4edc2c9b6b5b921873eb82e58719ed4d9e0d69bf (patch)
tree442a5560b9fc2c187c8dc6aa982733ff72e54c94 /src/resolve
parent11ab173d4067a4ed6fab811ba2159456053fd4c1 (diff)
networkd: FIONREAD is not reliable on some sockets
Fixes: #2457
Diffstat (limited to 'src/resolve')
-rw-r--r--src/resolve/resolved-manager.c10
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)