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-0dff7051ff02master
parent
521aa9acbc
commit
749243ef86
12
byterun/io.c
12
byterun/io.c
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue