1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2016-03-11 01:47:19 +00:00
parent cf09c0c351
commit d661eb44c7

7
ruby.c
View file

@ -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;
}
}