* ruby.c (open_load_file): revert r56385. it introduced incompatibility

about `DATA.binmode?`.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56401 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2016-10-12 12:07:16 +00:00
parent 21f1b89b9d
commit e592a735cb
2 changed files with 11 additions and 9 deletions

View File

@ -1,3 +1,8 @@
Wed Oct 12 21:05:50 2016 NAKAMURA Usaku <usa@ruby-lang.org>
* ruby.c (open_load_file): revert r56385. it introduced incompatibility
about `DATA.binmode?`.
Wed Oct 12 15:24:53 2016 SHIBATA Hiroshi <hsbt@ruby-lang.org> Wed Oct 12 15:24:53 2016 SHIBATA Hiroshi <hsbt@ruby-lang.org>
* tool/downloader.rb: Removed verification of gem certification. * tool/downloader.rb: Removed verification of gem certification.

15
ruby.c
View File

@ -1878,17 +1878,13 @@ open_load_file(VALUE fname_v, int *xflag)
use O_NONBLOCK. */ use O_NONBLOCK. */
#if defined O_NONBLOCK && HAVE_FCNTL && !(O_NONBLOCK & O_ACCMODE) #if defined O_NONBLOCK && HAVE_FCNTL && !(O_NONBLOCK & O_ACCMODE)
/* TODO: fix conflicting O_NONBLOCK in ruby/win32.h */ /* TODO: fix conflicting O_NONBLOCK in ruby/win32.h */
# define MODE_TO_LOAD (O_NONBLOCK) # define MODE_TO_LOAD (O_RDONLY | O_NONBLOCK)
#elif defined O_NDELAY && HAVE_FCNTL && !(O_NDELAY & O_ACCMODE) #elif defined O_NDELAY && HAVE_FCNTL && !(O_NDELAY & O_ACCMODE)
# define MODE_TO_LOAD (O_NDELAY) # define MODE_TO_LOAD (O_RDONLY | O_NDELAY)
#else #else
# define MODE_TO_LOAD (0) # define MODE_TO_LOAD (O_RDONLY)
#endif #endif
int mode = O_RDONLY | int mode = MODE_TO_LOAD;
#ifdef O_BINARY
O_BINARY |
#endif
MODE_TO_LOAD;
#if defined DOSISH || defined __CYGWIN__ #if defined DOSISH || defined __CYGWIN__
# define isdirsep(x) ((x) == '/' || (x) == '\\') # define isdirsep(x) ((x) == '/' || (x) == '\\')
{ {
@ -1896,6 +1892,7 @@ open_load_file(VALUE fname_v, int *xflag)
enum {extlen = sizeof(exeext)-1}; enum {extlen = sizeof(exeext)-1};
if (flen > extlen && !isdirsep(fname[flen-extlen-1]) && if (flen > extlen && !isdirsep(fname[flen-extlen-1]) &&
STRNCASECMP(fname+flen-extlen, exeext, extlen) == 0) { STRNCASECMP(fname+flen-extlen, exeext, extlen) == 0) {
mode |= O_BINARY;
*xflag = 1; *xflag = 1;
} }
} }
@ -1906,7 +1903,7 @@ open_load_file(VALUE fname_v, int *xflag)
} }
rb_update_max_fd(fd); rb_update_max_fd(fd);
#if defined HAVE_FCNTL && MODE_TO_LOAD #if defined HAVE_FCNTL && MODE_TO_LOAD != O_RDONLY
/* disabling O_NONBLOCK */ /* disabling O_NONBLOCK */
if (fcntl(fd, F_SETFL, 0) < 0) { if (fcntl(fd, F_SETFL, 0) < 0) {
e = errno; e = errno;