From 5521539314d87d3432e3c5c0e74954a673a884bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Wed, 23 Jul 2008 09:33:08 +0000 Subject: Vendor import of OpenSSH 5.1p1 --- atomicio.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'atomicio.c') diff --git a/atomicio.c b/atomicio.c index 575bf8900ee3..a6b2d127a9b8 100644 --- a/atomicio.c +++ b/atomicio.c @@ -63,11 +63,7 @@ atomicio(ssize_t (*f) (int, void *, size_t), int fd, void *_s, size_t n) case -1: if (errno == EINTR) continue; -#ifdef EWOULDBLOCK if (errno == EAGAIN || errno == EWOULDBLOCK) { -#else - if (errno == EAGAIN) { -#endif (void)poll(&pfd, 1, -1); continue; } @@ -101,20 +97,20 @@ atomiciov(ssize_t (*f) (int, const struct iovec *, int), int fd, /* Make a copy of the iov array because we may modify it below */ memcpy(iov, _iov, iovcnt * sizeof(*_iov)); +#ifndef BROKEN_READV_COMPARISON pfd.fd = fd; pfd.events = f == readv ? POLLIN : POLLOUT; +#endif for (; iovcnt > 0 && iov[0].iov_len > 0;) { res = (f) (fd, iov, iovcnt); switch (res) { case -1: if (errno == EINTR) continue; -#ifdef EWOULDBLOCK if (errno == EAGAIN || errno == EWOULDBLOCK) { -#else - if (errno == EAGAIN) { -#endif +#ifndef BROKEN_READV_COMPARISON (void)poll(&pfd, 1, -1); +#endif continue; } return 0; -- cgit v1.2.3