]> andersk Git - openssh.git/blobdiff - atomicio.c
- markus@cvs.openbsd.org 2004/01/30 09:48:57
[openssh.git] / atomicio.c
index 7d848cbfb2c25525777685a0511f64dc0bb76f87..7637e167198685f1d421764265f0e8868a01f1a0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999 Theo de Raadt
+ * Copyright (c) 1995,1999 Theo de Raadt.  All rights reserved.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-
 #include "includes.h"
-RCSID("$Id$");
+RCSID("$OpenBSD: atomicio.c,v 1.12 2003/07/31 15:50:16 avsm Exp $");
 
-#include "xmalloc.h"
-#include "ssh.h"
+#include "atomicio.h"
 
 /*
- * ensure all of data on socket comes through. f==read || f==write
+ * ensure all of data on socket comes through. f==read || f==vwrite
  */
-int
-atomicio(f, fd, s, n)
-       int (*f) ();
+ssize_t
+atomicio(f, fd, _s, n)
+       ssize_t (*f) (int, void *, size_t);
        int fd;
-       void *s;
+       void *_s;
        size_t n;
 {
-       int res, pos = 0;
+       char *s = _s;
+       ssize_t res, pos = 0;
 
        while (n > pos) {
                res = (f) (fd, s + pos, n - pos);
                switch (res) {
                case -1:
+#ifdef EWOULDBLOCK
+                       if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK)
+#else
                        if (errno == EINTR || errno == EAGAIN)
+#endif
                                continue;
                case 0:
                        return (res);
This page took 0.034592 seconds and 4 git commands to generate.