summaryrefslogtreecommitdiff
path: root/atomicio.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2014-01-30 11:26:46 +1100
committerDamien Miller <djm@mindrot.org>2014-01-30 11:26:46 +1100
commitf5bbd3b657b6340551c8a95f74a70857ff8fac79 (patch)
treefc645c6013a866a2d6c34b56c01e224ba280a81d /atomicio.c
parentc2868192ddc4e1420a50389e18c05db20b0b1f32 (diff)
downloadopenssh-git-f5bbd3b657b6340551c8a95f74a70857ff8fac79.tar.gz
- (djm) [configure.ac atomicio.c] Kludge around NetBSD offering
different symbols for 'read' when various compiler flags are in use, causing atomicio.c comparisons against it to break and read/write operations to hang; ok dtucker
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 601b3c37..2bac36c9 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,
ssize_t res;
struct pollfd pfd;
+#ifndef BROKEN_READ_COMPARISON
pfd.fd = fd;
pfd.events = f == read ? POLLIN : POLLOUT;
+#endif
while (n > pos) {
res = (f) (fd, s + pos, n - pos);
switch (res) {
@@ -65,7 +67,9 @@ atomicio6(ssize_t (*f) (int, void *, size_t), int fd, void *_s, size_t n,
if (errno == EINTR)
continue;
if (errno == EAGAIN || errno == EWOULDBLOCK) {
+#ifndef BROKEN_READ_COMPARISON
(void)poll(&pfd, 1, -1);
+#endif
continue;
}
return 0;