summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-11 01:47:19 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-11 01:47:19 +0000
commitd661eb44c7eb2ab13c4e1afa3b69f7614e0f85e1 (patch)
treee09e55ec52c8bcf7a81c3239618a6f40c9177c77 /ruby.c
parentcf09c0c351d15968819bbe73a5a9d9dc41a3e0d9 (diff)
ruby.c: load in binary mode
* ruby.c (open_load_file): always open in binary mode if provided, parser deals with CRs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54082 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/ruby.c b/ruby.c
index e8633275dc..b0c6c1cce9 100644
--- a/ruby.c
+++ b/ruby.c
@@ -1846,12 +1846,15 @@ open_load_file(VALUE fname_v, int *xflag)
#else
# define MODE_TO_LOAD (O_RDONLY)
#endif
- int mode = MODE_TO_LOAD;
+ const int mode =
+#ifdef O_BINARY
+ O_BINARY |
+#endif
+ MODE_TO_LOAD;
#if defined DOSISH || defined __CYGWIN__
{
const char *ext = strrchr(fname, '.');
if (ext && STRCASECMP(ext, ".exe") == 0) {
- mode |= O_BINARY;
*xflag = 1;
}
}