For discussion! Enable compilation using Visual C++ 2002 & 2003

This bizarre patch results in a full test-suite pass for Visual Studio
.NET 2002 & 2003. Without it, the following code segfaults (resulting in
6 failing tests):

```ocaml
  #load "unix.cma";;
  let (ifd, _) = Unix.pipe ();;
  Unix.in_channel_of_descr ifd;;
```
master
David Allsopp 2015-12-31 12:16:02 +00:00 committed by alainfrisch
parent 7ca7db4ef2
commit d31773e0f4
1 changed files with 3 additions and 0 deletions

View File

@ -46,6 +46,9 @@ CAMLprim value win_inchannel_of_filedescr(value handle)
CAMLlocal1(vchan);
struct channel * chan;
#if defined(_MSC_VER) && _MSC_VER < 1400
fflush(stdin);
#endif
chan = caml_open_descriptor_in(win_CRT_fd_of_filedescr(handle));
if (Descr_kind_val(handle) == KIND_SOCKET)
chan->flags |= CHANNEL_FLAG_FROM_SOCKET;