From 396d621f1cfedfdbd16e08b046436b14079420ae Mon Sep 17 00:00:00 2001 From: simonmar <unknown> Date: Tue, 4 Apr 2000 11:01:33 +0000 Subject: [PATCH] [project @ 2000-04-04 11:01:33 by simonmar] Fix the EOF condition in readChunk. --- ghc/lib/std/cbits/readFile.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ghc/lib/std/cbits/readFile.c b/ghc/lib/std/cbits/readFile.c index ee968ff85501..5c9256cd5a5e 100644 --- a/ghc/lib/std/cbits/readFile.c +++ b/ghc/lib/std/cbits/readFile.c @@ -1,7 +1,7 @@ /* * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 * - * $Id: readFile.c,v 1.13 2000/03/21 17:41:02 simonmar Exp $ + * $Id: readFile.c,v 1.14 2000/04/04 11:01:33 simonmar Exp $ * * hGetContents Runtime Support */ @@ -191,7 +191,13 @@ readChunk(StgForeignPtr ptr, StgAddr buf, StgInt off, StgInt len) /* EOF */ if ( count == 0 ) { FILEOBJ_SET_EOF(fo); - return total_count; + if ( total_count == 0 ) { + ghc_errtype = ERR_EOF; + ghc_errstr = ""; + return -1; + } else { + return total_count; + } /* Blocking */ } else if ( count == -1 && errno == EAGAIN) { -- GitLab