From 2f7275db779be068e3401376224601251f01046b Mon Sep 17 00:00:00 2001 From: eban Date: Sat, 15 Feb 2003 18:16:52 +0000 Subject: * io.c (prep_stdio, Init_io): always set binmode on Cygwin. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3496 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- io.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'io.c') diff --git a/io.c b/io.c index 8b5ee5ac75..d4baa9f774 100644 --- a/io.c +++ b/io.c @@ -2783,6 +2783,10 @@ prep_stdio(f, mode, klass) VALUE io = io_alloc(klass); MakeOpenFile(io, fp); +#ifdef __CYGWIN__ + mode |= O_BINARY; + setmode(fileno(f), O_BINARY); +#endif fp->f = f; fp->mode = mode; @@ -3894,6 +3898,19 @@ opt_i_set(val) void Init_IO() { +#ifdef __CYGWIN__ +#include + static struct __cygwin_perfile pf[] = + { + {"", O_RDONLY | O_BINARY}, + {"", O_WRONLY | O_BINARY}, + {"", O_RDWR | O_BINARY}, + {"", O_APPEND | O_BINARY}, + {NULL, 0} + }; + cygwin_internal(CW_PERFILE, pf); +#endif + rb_eIOError = rb_define_class("IOError", rb_eStandardError); rb_eEOFError = rb_define_class("EOFError", rb_eIOError); -- cgit v1.2.3