summaryrefslogtreecommitdiff
path: root/src/resolve
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-02-16 23:53:44 +0100
committerLennart Poettering <lennart@poettering.net>2016-02-16 23:53:44 +0100
commit12343facf32d5d4c7945f9768db09fd2a8526cd2 (patch)
tree9e6035ad571bd87df655f2e82c000d3a7cd8242c /src/resolve
parentbd8b65996c2bb2f44453f815fcd2e083827c15a3 (diff)
parent4edc2c9b6b5b921873eb82e58719ed4d9e0d69bf (diff)
Merge pull request #2626 from poettering/fionread-fix
networkd: FIONREAD is not reliable on some sockets
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)