]> andersk Git - openssh.git/blobdiff - atomicio.c
- pvalchev@cvs.openbsd.org 2007/06/07 19:41:46
[openssh.git] / atomicio.c
index 253139e991c71c82a35fe99f9c1c0f491a452bd2..575bf8900ee39e9e3cb89061934b659bd87b52d6 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: atomicio.c,v 1.24 2007/06/19 02:04:43 djm Exp $ */
+/* $OpenBSD: atomicio.c,v 1.25 2007/06/25 12:02:27 dtucker Exp $ */
 /*
  * Copyright (c) 2006 Damien Miller. All rights reserved.
  * Copyright (c) 2005 Anil Madhavapeddy. All rights reserved.
 
 #include <sys/param.h>
 #include <sys/uio.h>
-#include <sys/poll.h>
 
 #include <errno.h>
+#ifdef HAVE_POLL_H
+#include <poll.h>
+#else
+# ifdef HAVE_SYS_POLL_H
+#  include <sys/poll.h>
+# endif
+#endif
 #include <string.h>
 #include <unistd.h>
 
@@ -55,13 +61,13 @@ atomicio(ssize_t (*f) (int, void *, size_t), int fd, void *_s, size_t n)
                res = (f) (fd, s + pos, n - pos);
                switch (res) {
                case -1:
-#ifdef EWOULDBLOCK
-                       if (errno == EINTR || errno == EWOULDBLOCK)
-#else
                        if (errno == EINTR)
-#endif
                                continue;
+#ifdef EWOULDBLOCK
+                       if (errno == EAGAIN || errno == EWOULDBLOCK) {
+#else
                        if (errno == EAGAIN) {
+#endif
                                (void)poll(&pfd, 1, -1);
                                continue;
                        }
@@ -103,7 +109,11 @@ atomiciov(ssize_t (*f) (int, const struct iovec *, int), int fd,
                case -1:
                        if (errno == EINTR)
                                continue;
+#ifdef EWOULDBLOCK
+                       if (errno == EAGAIN || errno == EWOULDBLOCK) {
+#else
                        if (errno == EAGAIN) {
+#endif
                                (void)poll(&pfd, 1, -1);
                                continue;
                        }
This page took 1.455756 seconds and 4 git commands to generate.