Skip to content
  • Isamu Mogi's avatar
    Avoid to pass a socket to setmode/isatty in Windows · b9be82d4
    Isamu Mogi authored
    Summary:
    In Windows, a socket is not a file descriptor. So passing it to
    setmode/isatty causes an error that returns EABF and triggers invalid
    parameter handler.
    
    Test Plan:
    1. Add WinDbg as a postmortem debugger (C:\>windbg -I)
    2. Pass a socket to GHC.IO.Device.IODevice.isTerminal / GHC.IO.FD.fdToHandle'  (Executing 'cabal update' calls each functions with the socket in cabal-install 1.20.0.1)
    3. WinDbg pops up and outputs error message: "Invalid parameter passed to C runtime function."
    4. Apply the patch
    5. Redo step 2
    6. WinDbg doesn't pop up
    
    Reviewers: austin
    
    Reviewed By: austin
    
    Subscribers: phaskell, simonmar, relrod, carter
    
    Differential Revision: https://phabricator.haskell.org/D92
    b9be82d4