mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* io.c (io_reopen): STDOUT.reopen(filename, "w+") didn't work.
(rb_io_reopen): STDOUT.reopen(File.open(filename, "w+")) didn't work. This commit is a result of hacks at the CodeFest Akihabara 2006 hosted by FSIJ. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
034b25f797
commit
62a7c8fb13
2 changed files with 9 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Sun Jul 2 11:22:03 2006 Tanaka Akira <akr@m17n.org>
|
||||||
|
|
||||||
|
* io.c (io_reopen): STDOUT.reopen(filename, "w+") didn't work.
|
||||||
|
(rb_io_reopen): STDOUT.reopen(File.open(filename, "w+")) didn't work.
|
||||||
|
|
||||||
Sat Jul 1 23:55:42 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Sat Jul 1 23:55:42 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* eval.c (PUSH_FRAME): initialize frame->self. [ruby-dev:28911]
|
* eval.c (PUSH_FRAME): initialize frame->self. [ruby-dev:28911]
|
||||||
|
|
6
io.c
6
io.c
|
@ -3425,7 +3425,8 @@ io_reopen(VALUE io, VALUE nfile)
|
||||||
if (fptr == orig) return io;
|
if (fptr == orig) return io;
|
||||||
#if !defined __CYGWIN__
|
#if !defined __CYGWIN__
|
||||||
if (IS_PREP_STDIO(fptr)) {
|
if (IS_PREP_STDIO(fptr)) {
|
||||||
if ((fptr->mode & FMODE_READWRITE) != (orig->mode & FMODE_READWRITE)) {
|
if (((fptr->mode & FMODE_READWRITE) & (orig->mode & FMODE_READWRITE)) !=
|
||||||
|
(fptr->mode & FMODE_READWRITE)) {
|
||||||
rb_raise(rb_eArgError,
|
rb_raise(rb_eArgError,
|
||||||
"%s can't change access mode from \"%s\" to \"%s\"",
|
"%s can't change access mode from \"%s\" to \"%s\"",
|
||||||
PREP_STDIO_NAME(fptr), rb_io_flags_mode(fptr->mode),
|
PREP_STDIO_NAME(fptr), rb_io_flags_mode(fptr->mode),
|
||||||
|
@ -3536,7 +3537,8 @@ rb_io_reopen(int argc, VALUE *argv, VALUE file)
|
||||||
if (!NIL_P(nmode)) {
|
if (!NIL_P(nmode)) {
|
||||||
int flags = rb_io_mode_flags(StringValuePtr(nmode));
|
int flags = rb_io_mode_flags(StringValuePtr(nmode));
|
||||||
if (IS_PREP_STDIO(fptr) &&
|
if (IS_PREP_STDIO(fptr) &&
|
||||||
(fptr->mode & FMODE_READWRITE) != (flags & FMODE_READWRITE)) {
|
((fptr->mode & FMODE_READWRITE) & (flags & FMODE_READWRITE)) !=
|
||||||
|
(fptr->mode & FMODE_READWRITE)) {
|
||||||
rb_raise(rb_eArgError,
|
rb_raise(rb_eArgError,
|
||||||
"%s can't change access mode from \"%s\" to \"%s\"",
|
"%s can't change access mode from \"%s\" to \"%s\"",
|
||||||
PREP_STDIO_NAME(fptr), rb_io_flags_mode(fptr->mode),
|
PREP_STDIO_NAME(fptr), rb_io_flags_mode(fptr->mode),
|
||||||
|
|
Loading…
Reference in a new issue