summaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
authoreban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-02-15 18:16:52 +0000
committereban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-02-15 18:16:52 +0000
commitce49de8b83cf2d5cc936691843dfaecf5a8db127 (patch)
tree617c3a5ab312127a0450fa499d51c4fc7908d26b /io.c
parent60566d329892360618457243ecba28243ca590ac (diff)
downloadruby-ce49de8b83cf2d5cc936691843dfaecf5a8db127.tar.gz
ruby-ce49de8b83cf2d5cc936691843dfaecf5a8db127.tar.xz
ruby-ce49de8b83cf2d5cc936691843dfaecf5a8db127.zip
* io.c (prep_stdio, Init_io): always set binmode on Cygwin.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3496 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/io.c b/io.c
index 8b5ee5ac7..d4baa9f77 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 <sys/cygwin.h>
+ 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);