summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libc/asr/res_send_async.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/lib/libc/asr/res_send_async.c b/lib/libc/asr/res_send_async.c
index e8457c26bc5..487890fa318 100644
--- a/lib/libc/asr/res_send_async.c
+++ b/lib/libc/asr/res_send_async.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: res_send_async.c,v 1.14 2013/04/03 19:38:20 matthew Exp $ */
+/* $OpenBSD: res_send_async.c,v 1.15 2013/04/05 07:12:24 eric Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
@@ -557,9 +557,13 @@ tcp_write(struct async *as)
msg.msg_iov = iov;
msg.msg_iovlen = i;
+ send_again:
n = sendmsg(as->as_fd, &msg, MSG_NOSIGNAL);
- if (n == -1)
+ if (n == -1) {
+ if (errno == EINTR)
+ goto send_again;
goto close; /* errno set */
+ }
as->as.dns.datalen += n;
@@ -613,9 +617,13 @@ tcp_read(struct async *as)
pfd.fd = as->as_fd;
pfd.events = POLLIN;
+ poll_again:
nfds = poll(&pfd, 1, 0);
- if (nfds == -1)
+ if (nfds == -1) {
+ if (errno == EINTR)
+ goto poll_again;
goto close; /* errno set */
+ }
if (nfds == 0)
return (1); /* no more data available */
}
@@ -624,9 +632,13 @@ tcp_read(struct async *as)
pos = as->as.dns.ibuf + offset;
len = as->as.dns.ibuflen - offset;
+ read_again:
n = read(as->as_fd, pos, len);
- if (n == -1)
+ if (n == -1) {
+ if (errno == EINTR)
+ goto read_again;
goto close; /* errno set */
+ }
if (n == 0) {
errno = ECONNRESET;
goto close;