Si EAGAIN lors d'une ecriture, reessayer avec 1 caractere seulement.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@778 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Xavier Leroy 1996-04-29 16:56:34 +00:00
parent 521aa9acbc
commit 749243ef86
1 changed files with 7 additions and 5 deletions

View File

@ -122,11 +122,13 @@ again:
if (retcode == -1) {
if (errno == EINTR) goto again;
if (errno == EAGAIN || errno == EWOULDBLOCK) {
/* POSIX says that a write on a pipe in non-blocking mode may return
EAGAIN if it attempts to write more than PIPE_BUF characters,
PIPE_BUF being at least 512. In this case, we try again with
strictly less than PIPE_BUF characters. */
if (n >= 512) { n = 256; goto again; }
/* We couldn't do a partial write here, probably because
n <= PIPE_BUF and POSIX says that writes of less than
PIPE_BUF characters must be atomic.
So, we force a partial write of 1 character.
This should always succeed if we've done a select
on writing just before. */
if (n > 1) { n = 1; goto again; }
}
}
#endif