[project @ 1999-02-25 10:18:28 by sof]
authorsof <unknown>
Thu, 25 Feb 1999 10:18:28 +0000 (10:18 +0000)
committersof <unknown>
Thu, 25 Feb 1999 10:18:28 +0000 (10:18 +0000)
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.

ghc/lib/std/PrelHandle.lhs

index 6fba7e0..ebb444f 100644 (file)
@@ -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