From 6afe2e84d3df564f263d179943b3321ac9b02271 Mon Sep 17 00:00:00 2001 From: sof Date: Mon, 24 Aug 1998 10:53:41 +0000 Subject: [PATCH] [project @ 1998-08-24 10:53:41 by sof] readChunk: last commit may have fixed a bug in the handling of incomplete reads, but at the cost of breaking the (common) case of complete reads :-/. Should work better in both cases now. --- ghc/lib/std/cbits/readFile.lc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ghc/lib/std/cbits/readFile.lc b/ghc/lib/std/cbits/readFile.lc index 457db8f..d740fb4 100644 --- a/ghc/lib/std/cbits/readFile.lc +++ b/ghc/lib/std/cbits/readFile.lc @@ -158,7 +158,7 @@ StgInt len; while ((count = read(fd, p, len)) < len) { if ( count == 0 ) { /* EOF */ - return total_count; + break; } else if ( count == -1 && errno == EAGAIN) { errno = 0; return FILEOBJ_BLOCKED_READ; @@ -172,6 +172,7 @@ StgInt len; p += count; } + total_count += count; fo->bufWPtr = total_count; fo->bufRPtr = 0; return total_count; -- 1.7.10.4