diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 1996-04-29 16:56:34 +0000 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 1996-04-29 16:56:34 +0000 |
commit | 749243ef86296b949b12f74ec5df07fe8dd79b2b (patch) | |
tree | c7ac2b2245af99a0a8f235b2c1ecba0624016346 /byterun/io.c | |
parent | 521aa9acbcfe94e4984e6e2a9d27e3614ef8e71c (diff) |
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
Diffstat (limited to 'byterun/io.c')
-rw-r--r-- | byterun/io.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/byterun/io.c b/byterun/io.c index 50b5b149b..0c3f22dec 100644 --- a/byterun/io.c +++ b/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 |