diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-10-12 12:07:16 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-10-12 12:07:16 +0000 |
commit | 5d1f67941aedaaf0c050b64614f9e5bdc828e91d (patch) | |
tree | 46f35b9bdbb87cc9d4cf9caa18083f50bfbac2de | |
parent | 9ec886372beba0017c2633f94ec88fabf63e6ebf (diff) | |
download | ruby-5d1f67941aedaaf0c050b64614f9e5bdc828e91d.tar.gz |
* 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
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | ruby.c | 15 |
2 files changed, 11 insertions, 9 deletions
@@ -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> * tool/downloader.rb: Removed verification of gem certification. @@ -1878,17 +1878,13 @@ open_load_file(VALUE fname_v, int *xflag) use O_NONBLOCK. */ #if defined O_NONBLOCK && HAVE_FCNTL && !(O_NONBLOCK & O_ACCMODE) /* 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) -# define MODE_TO_LOAD (O_NDELAY) +# define MODE_TO_LOAD (O_RDONLY | O_NDELAY) #else -# define MODE_TO_LOAD (0) +# define MODE_TO_LOAD (O_RDONLY) #endif - int mode = O_RDONLY | -#ifdef O_BINARY - O_BINARY | -#endif - MODE_TO_LOAD; + int mode = MODE_TO_LOAD; #if defined DOSISH || defined __CYGWIN__ # define isdirsep(x) ((x) == '/' || (x) == '\\') { @@ -1896,6 +1892,7 @@ open_load_file(VALUE fname_v, int *xflag) enum {extlen = sizeof(exeext)-1}; if (flen > extlen && !isdirsep(fname[flen-extlen-1]) && STRNCASECMP(fname+flen-extlen, exeext, extlen) == 0) { + mode |= O_BINARY; *xflag = 1; } } @@ -1906,7 +1903,7 @@ open_load_file(VALUE fname_v, int *xflag) } rb_update_max_fd(fd); -#if defined HAVE_FCNTL && MODE_TO_LOAD +#if defined HAVE_FCNTL && MODE_TO_LOAD != O_RDONLY /* disabling O_NONBLOCK */ if (fcntl(fd, F_SETFL, 0) < 0) { e = errno; |