mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-10 19:30:10 +00:00
Better error handling for sendmmsg use in res_send
This commit is contained in:
parent
8e6d108343
commit
966977f1b7
@ -1132,22 +1132,23 @@ send_dg(res_state statp,
|
|||||||
int ndg = sendmmsg (pfd[0].fd, reqs, 2, MSG_NOSIGNAL);
|
int ndg = sendmmsg (pfd[0].fd, reqs, 2, MSG_NOSIGNAL);
|
||||||
if (__builtin_expect (ndg == 2, 1))
|
if (__builtin_expect (ndg == 2, 1))
|
||||||
{
|
{
|
||||||
assert (reqs[0].msg_len == buflen);
|
if (reqs[0].msg_len != buflen
|
||||||
assert (reqs[1].msg_len == buflen2);
|
|| reqs[1].msg_len != buflen2)
|
||||||
|
goto fail_sendmmsg;
|
||||||
|
|
||||||
pfd[0].events = POLLIN;
|
pfd[0].events = POLLIN;
|
||||||
nwritten += 2;
|
nwritten += 2;
|
||||||
}
|
}
|
||||||
else if (ndg == 1 && reqs[0].msg_len == buflen)
|
else if (ndg == 1 && reqs[0].msg_len == buflen)
|
||||||
goto just_one;
|
goto just_one;
|
||||||
else if (errno == EINTR || errno == EAGAIN)
|
else if (ndg < 0 && (errno == EINTR || errno == EAGAIN))
|
||||||
goto recompute_resend;
|
goto recompute_resend;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifndef __ASSUME_SENDMMSG
|
#ifndef __ASSUME_SENDMMSG
|
||||||
if (have_sendmmsg == 0)
|
if (__builtin_expect (have_sendmmsg == 0, 0))
|
||||||
{
|
{
|
||||||
if (errno == ENOSYS)
|
if (ndg < 0 && errno == ENOSYS)
|
||||||
{
|
{
|
||||||
have_sendmmsg = -1;
|
have_sendmmsg = -1;
|
||||||
goto try_send;
|
goto try_send;
|
||||||
@ -1156,6 +1157,7 @@ send_dg(res_state statp,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
fail_sendmmsg:
|
||||||
Perror(statp, stderr, "sendmmsg", errno);
|
Perror(statp, stderr, "sendmmsg", errno);
|
||||||
goto err_out;
|
goto err_out;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user