[commit: ghc] ghc-8.0: Use the correct return type for Windows' send()/recv() (Fix #12010) (2a6ac3f)

git at git.haskell.org git at git.haskell.org
Mon Sep 5 21:27:14 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/2a6ac3f18dc6e8abc779b8fbc7232e972f4a8a7d/ghc

>---------------------------------------------------------------

commit 2a6ac3f18dc6e8abc779b8fbc7232e972f4a8a7d
Author: Tamar Christina <tamar at zhox.com>
Date:   Thu May 19 21:48:53 2016 +0200

    Use the correct return type for Windows' send()/recv() (Fix #12010)
    
    Summary:
    They return signed 32 bit ints on Windows, even on a 64 bit OS, rather than
    Linux's 64 bit ssize_t. This means when recv() returned -1 to signal an error we
    thought it was 4294967295. It was converted to an int, -1 and the buffer was
    memcpy'd which caused a segfault. Other bad stuff happened with send()s.
    
    See also note CSsize in System.Posix.Internals.
    
    Add a test for #12010
    
    Test Plan:
    - GHC testsuite (T12010)
    - http-conduit test (https://github.com/snoyberg/http-client/issues/191)
    
    Reviewers: austin, hvr, bgamari, Phyx
    
    Reviewed By: Phyx
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D2170
    
    GHC Trac Issues: #12010
    
    (cherry picked from commit 1ee47c1bfa35c7be435adaec5c1fa9ec92cc776d)


>---------------------------------------------------------------

2a6ac3f18dc6e8abc779b8fbc7232e972f4a8a7d
 libraries/base/GHC/IO/FD.hs                        | 16 ++++----
 libraries/base/System/Posix/Internals.hs           | 41 ++++++++++-----------
 libraries/base/tests/IO/T12010/Makefile            | 10 +++++
 libraries/base/tests/IO/T12010/T12010.hsc          | 40 ++++++++++++++++++++
 libraries/base/tests/IO/T12010/T12010.stdout       |  2 +
 libraries/base/tests/IO/T12010/cbits/initWinSock.c | 43 ++++++++++++++++++++++
 libraries/base/tests/IO/T12010/test.T              |  8 ++++
 7 files changed, 131 insertions(+), 29 deletions(-)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 2a6ac3f18dc6e8abc779b8fbc7232e972f4a8a7d


More information about the ghc-commits mailing list