X-Git-Url: http://andersk.mit.edu/gitweb/openssh.git/blobdiff_plain/a408af7667dc3e5b745c961bd9ed33c31ec063b8..d60970230cf34217f9cb75f58790dd1a73703ba1:/atomicio.c diff --git a/atomicio.c b/atomicio.c index 1b960e56..47161eb3 100644 --- a/atomicio.c +++ b/atomicio.c @@ -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 @@ -24,28 +24,32 @@ */ #include "includes.h" -RCSID("$Id$"); +RCSID("$OpenBSD: atomicio.c,v 1.10 2001/05/08 22:48:07 markus Exp $"); -#include "xmalloc.h" -#include "ssh.h" +#include "atomicio.h" /* * ensure all of data on socket comes through. f==read || f==write */ -int -atomicio(f, fd, s, n) - int (*f) (); +ssize_t +atomicio(f, fd, _s, n) + ssize_t (*f) (); 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);