summaryrefslogtreecommitdiff
path: root/atomicio.c
diff options
context:
space:
mode:
Diffstat (limited to 'atomicio.c')
-rw-r--r--atomicio.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/atomicio.c b/atomicio.c
index 601b3c371..2bac36c91 100644
--- a/atomicio.c
+++ b/atomicio.c
@@ -56,8 +56,10 @@ atomicio6(ssize_t (*f) (int, void *, size_t), int fd, void *_s, size_t n,
56 ssize_t res; 56 ssize_t res;
57 struct pollfd pfd; 57 struct pollfd pfd;
58 58
59#ifndef BROKEN_READ_COMPARISON
59 pfd.fd = fd; 60 pfd.fd = fd;
60 pfd.events = f == read ? POLLIN : POLLOUT; 61 pfd.events = f == read ? POLLIN : POLLOUT;
62#endif
61 while (n > pos) { 63 while (n > pos) {
62 res = (f) (fd, s + pos, n - pos); 64 res = (f) (fd, s + pos, n - pos);
63 switch (res) { 65 switch (res) {
@@ -65,7 +67,9 @@ atomicio6(ssize_t (*f) (int, void *, size_t), int fd, void *_s, size_t n,
65 if (errno == EINTR) 67 if (errno == EINTR)
66 continue; 68 continue;
67 if (errno == EAGAIN || errno == EWOULDBLOCK) { 69 if (errno == EAGAIN || errno == EWOULDBLOCK) {
70#ifndef BROKEN_READ_COMPARISON
68 (void)poll(&pfd, 1, -1); 71 (void)poll(&pfd, 1, -1);
72#endif
69 continue; 73 continue;
70 } 74 }
71 return 0; 75 return 0;