mirror of
git://git.musl-libc.org/musl
synced 2025-03-31 23:58:56 +00:00
dns: handle early eof in tcp fallback
A zero returned from recvmsg is currently treated as if some data were received, so if a DNS server closes its TCP socket before sending the full answer, __res_msend_rc will spin until the timeout elapses because POLLIN event will be reported on each poll. Fix this by treating an early EOF as an error.
This commit is contained in:
parent
9b132e5567
commit
bec42ef393
@ -287,7 +287,7 @@ int __res_msend_rc(int nqueries, const unsigned char *const *queries,
|
||||
};
|
||||
step_mh(&mh, apos[i]);
|
||||
r = recvmsg(pfd[i].fd, &mh, 0);
|
||||
if (r < 0) goto out;
|
||||
if (r <= 0) goto out;
|
||||
apos[i] += r;
|
||||
if (apos[i] < 2) continue;
|
||||
int alen = alen_buf[i][0]*256 + alen_buf[i][1];
|
||||
|
Loading…
Reference in New Issue
Block a user