#3128: hClose leaves file descriptor open if it fails
---------------------------------+------------------------------------------
Reporter: Baughn | Owner: simonmar
Type: bug | Status: new
Priority: normal | Milestone: 6.12.1
Component: libraries/base | Version: 6.10.1
Severity: normal | Resolution:
Keywords: | Difficulty: Unknown
Testcase: | Os: Unknown/Multiple
Architecture: Unknown/Multiple |
---------------------------------+------------------------------------------
Comment (by simonmar):
Replying to [comment:4 Baughn]:
> I would like to add that Handles *should* contain an MVar (Maybe FD) or
some such instead of just an FD. Or, rather, after a handle is hClosed -
and the socket goes away - it ought to be impossible to use that handle
for anything whatsoever.
>
> As it is now, it's possible for the FD to be reused, and for code that
reuses the closed Handle to touch someone else's FD.
>
> This may not violate the haskell spec, but neither would code where you
can't do that, and the cost would be trivial.
I don't think I understand what problem you're referring to. The `Handle`
has a status, which is set to `ClosedHandle` when it is closed. When a
`Handle` is marked as closed in this way, nothing should be using the
`FD`. (this is all different in the rewrite of the IO library anyway).
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3128#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs