diff options
Diffstat (limited to 'ghc/lib/std/cbits/writeFile.c')
-rw-r--r-- | ghc/lib/std/cbits/writeFile.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/ghc/lib/std/cbits/writeFile.c b/ghc/lib/std/cbits/writeFile.c index 0b459f33b8..0c2f78fd0d 100644 --- a/ghc/lib/std/cbits/writeFile.c +++ b/ghc/lib/std/cbits/writeFile.c @@ -1,7 +1,7 @@ /* * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 * - * $Id: writeFile.c,v 1.8 1999/09/16 13:14:43 simonmar Exp $ + * $Id: writeFile.c,v 1.9 1999/11/05 15:25:49 simonmar Exp $ * * hPutStr Runtime Support */ @@ -62,13 +62,19 @@ StgInt bytes; #else write(fo->fd, pBuf, bytes))) < bytes) { #endif - if (errno != EINTR) { + if ( count == -1 && errno == EAGAIN) { + errno = 0; + return FILEOBJ_BLOCKED_WRITE; + } + else if ( count == -1 && errno != EINTR ) { cvtErrno(); stdErrno(); return -1; } - bytes -= count; - pBuf += count; + else { + bytes -= count; + pBuf += count; + } } /* Signal that we've emptied the buffer */ fo->bufWPtr=0; |