diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-08-06 08:14:05 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-08-06 08:14:05 +0000 |
commit | e91bdce87766118b9be77839fb7db65b11e38015 (patch) | |
tree | 93743005d290bb70646dc924ab146c59f776b5fe | |
parent | d92db05a27d7c97386dfa8bc77fb865aba9df751 (diff) | |
download | ruby-e91bdce87766118b9be77839fb7db65b11e38015.tar.gz |
* io.c (io_reopen): STDERR.reopen(open("/dev/tty", "w")) should not
clear FMODE_PREP in STDERR.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | io.c | 8 |
2 files changed, 8 insertions, 5 deletions
@@ -1,3 +1,8 @@ +Sun Aug 6 17:12:12 2006 Tanaka Akira <akr@fsij.org> + + * io.c (io_reopen): STDERR.reopen(open("/dev/tty", "w")) should not + clear FMODE_PREP in STDERR. + Sat Aug 5 22:53:41 2006 K.Kosako <sndgk393 AT ybb.ne.jp> * oniguruma.h: Version 4.2.2 @@ -3412,7 +3412,6 @@ io_reopen(VALUE io, VALUE nfile) OpenFile *fptr, *orig; int fd, fd2; off_t pos = 0; - int fptr_is_prep_stdio; nfile = rb_io_get_io(nfile); if (rb_safe_level() >= 4 && (!OBJ_TAINTED(io) || !OBJ_TAINTED(nfile))) { @@ -3423,8 +3422,7 @@ io_reopen(VALUE io, VALUE nfile) if (fptr == orig) return io; #if !defined __CYGWIN__ - fptr_is_prep_stdio = IS_PREP_STDIO(fptr); - if (fptr_is_prep_stdio) { + if (IS_PREP_STDIO(fptr)) { if (((fptr->mode & FMODE_READWRITE) & (orig->mode & FMODE_READWRITE)) != (fptr->mode & FMODE_READWRITE)) { rb_raise(rb_eArgError, @@ -3445,7 +3443,7 @@ io_reopen(VALUE io, VALUE nfile) } /* copy OpenFile structure */ - fptr->mode = orig->mode; + fptr->mode = orig->mode | (fptr->mode & FMODE_PREP); fptr->pid = orig->pid; fptr->lineno = orig->lineno; if (fptr->path) free(fptr->path); @@ -3457,7 +3455,7 @@ io_reopen(VALUE io, VALUE nfile) fd2 = orig->fd; if (fd != fd2) { #if !defined __CYGWIN__ - if (fptr_is_prep_stdio) { + if (IS_PREP_STDIO(fptr)) { /* need to keep stdio objects */ if (dup2(fd2, fd) < 0) rb_sys_fail(orig->path); |