diff options
Diffstat (limited to 'atomicio.c')
-rw-r--r-- | atomicio.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/atomicio.c b/atomicio.c index bb44c3230..a6b2d127a 100644 --- a/atomicio.c +++ b/atomicio.c | |||
@@ -97,8 +97,10 @@ atomiciov(ssize_t (*f) (int, const struct iovec *, int), int fd, | |||
97 | /* Make a copy of the iov array because we may modify it below */ | 97 | /* Make a copy of the iov array because we may modify it below */ |
98 | memcpy(iov, _iov, iovcnt * sizeof(*_iov)); | 98 | memcpy(iov, _iov, iovcnt * sizeof(*_iov)); |
99 | 99 | ||
100 | #ifndef BROKEN_READV_COMPARISON | ||
100 | pfd.fd = fd; | 101 | pfd.fd = fd; |
101 | pfd.events = f == readv ? POLLIN : POLLOUT; | 102 | pfd.events = f == readv ? POLLIN : POLLOUT; |
103 | #endif | ||
102 | for (; iovcnt > 0 && iov[0].iov_len > 0;) { | 104 | for (; iovcnt > 0 && iov[0].iov_len > 0;) { |
103 | res = (f) (fd, iov, iovcnt); | 105 | res = (f) (fd, iov, iovcnt); |
104 | switch (res) { | 106 | switch (res) { |
@@ -106,7 +108,9 @@ atomiciov(ssize_t (*f) (int, const struct iovec *, int), int fd, | |||
106 | if (errno == EINTR) | 108 | if (errno == EINTR) |
107 | continue; | 109 | continue; |
108 | if (errno == EAGAIN || errno == EWOULDBLOCK) { | 110 | if (errno == EAGAIN || errno == EWOULDBLOCK) { |
111 | #ifndef BROKEN_READV_COMPARISON | ||
109 | (void)poll(&pfd, 1, -1); | 112 | (void)poll(&pfd, 1, -1); |
113 | #endif | ||
110 | continue; | 114 | continue; |
111 | } | 115 | } |
112 | return 0; | 116 | return 0; |