From: sof Date: Thu, 25 Feb 1999 10:18:28 +0000 (+0000) Subject: [project @ 1999-02-25 10:18:28 by sof] X-Git-Tag: Approximately_9120_patches~6512 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=aef250c32e2ad2946b61cbc678907503073554db;p=ghc-hetmet.git [project @ 1999-02-25 10:18:28 by sof] hClose: don't raise an exception when passed a handle that's already closed, i.e., h <- openFile "a" ReadMode >> hClose h >> hClose h will now succeed (provided 'a' exists and is readable, of course.) Repeated hClose's are just redundant. --- diff --git a/ghc/lib/std/PrelHandle.lhs b/ghc/lib/std/PrelHandle.lhs index 6fba7e0..ebb444f 100644 --- a/ghc/lib/std/PrelHandle.lhs +++ b/ghc/lib/std/PrelHandle.lhs @@ -365,7 +365,7 @@ hClose handle = ioError theError ClosedHandle -> do writeHandle handle handle_ - ioe_closedHandle "hClose" handle + return () _ -> do rc <- CCALL(closeFile) (haFO__ handle_) (1::Int){-flush if you can-} -- ConcHask: SAFE, won't block {- We explicitly close a file object so that we can be told