diff options
author | Simon Marlow <marlowsd@gmail.com> | 2010-09-15 14:18:09 +0000 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2010-09-15 14:18:09 +0000 |
commit | 0cbb1f34579da2b3ba8e199c3a95f6312710659f (patch) | |
tree | 3d50b8d2007b8dd8011e01b0bc701f7cca5b1f3c /rts/win32/IOManager.c | |
parent | 65da401ae6579ad47f06bcf80b1f3022c9963ca4 (diff) | |
download | haskell-0cbb1f34579da2b3ba8e199c3a95f6312710659f.tar.gz |
errno corresponding to ERROR_NO_DATA should be EPIPE (non-threaded RTS)
Diffstat (limited to 'rts/win32/IOManager.c')
-rw-r--r-- | rts/win32/IOManager.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/rts/win32/IOManager.c b/rts/win32/IOManager.c index 81dedda569..c9a759fffb 100644 --- a/rts/win32/IOManager.c +++ b/rts/win32/IOManager.c @@ -16,6 +16,7 @@ #include <io.h> #include <winsock.h> #include <process.h> +#include <errno.h> /* * Internal state maintained by the IO manager. @@ -181,7 +182,15 @@ IOWorkerProc(PVOID param) len = write(work->workData.ioData.fd, work->workData.ioData.buf, work->workData.ioData.len); - if (len == -1) { errCode = errno; } + if (len == -1) { + errCode = errno; + // write() gets errno wrong for + // ERROR_NO_DATA, we have to fix it here: + if (errCode == EINVAL && + GetLastError() == ERROR_NO_DATA) { + errCode = EPIPE; + } + } } complData = work->workData.ioData.buf; fd = work->workData.ioData.fd; |