diff options
| author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-08-03 16:30:46 +0000 |
|---|---|---|
| committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-08-03 16:30:46 +0000 |
| commit | e40d63b1b5f0774c2b7de9bb781c553bc6b227b7 (patch) | |
| tree | 934c788718e1d90dd2aa73cbb9119d964b4252d9 | |
| parent | 8afc2edc62a1fa93b03d3eb817c4478f3b49be95 (diff) | |
| download | ruby-e40d63b1b5f0774c2b7de9bb781c553bc6b227b7.tar.gz ruby-e40d63b1b5f0774c2b7de9bb781c553bc6b227b7.tar.xz ruby-e40d63b1b5f0774c2b7de9bb781c553bc6b227b7.zip | |
* io.c (io_reopen): STDERR.reopen(File.open("/dev/null", "w")) should
not fclose stderr.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@10658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | io.c | 6 |
2 files changed, 9 insertions, 2 deletions
@@ -1,3 +1,8 @@ +Fri Aug 4 01:28:19 2006 Tanaka Akira <akr@fsij.org> + + * io.c (io_reopen): STDERR.reopen(File.open("/dev/null", "w")) should + not fclose stderr. + Thu Aug 3 15:16:44 2006 Yukihiro Matsumoto <matz@ruby-lang.org> * range.c (range_include): should always call Enumerable#include? @@ -3412,6 +3412,7 @@ 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))) { @@ -3422,7 +3423,8 @@ io_reopen(VALUE io, VALUE nfile) if (fptr == orig) return io; #if !defined __CYGWIN__ - if (IS_PREP_STDIO(fptr)) { + fptr_is_prep_stdio = IS_PREP_STDIO(fptr); + if (fptr_is_prep_stdio) { if (((fptr->mode & FMODE_READWRITE) & (orig->mode & FMODE_READWRITE)) != (fptr->mode & FMODE_READWRITE)) { rb_raise(rb_eArgError, @@ -3455,7 +3457,7 @@ io_reopen(VALUE io, VALUE nfile) fd2 = orig->fd; if (fd != fd2) { #if !defined __CYGWIN__ - if (IS_PREP_STDIO(fptr)) { + if (fptr_is_prep_stdio) { /* need to keep stdio objects */ if (dup2(fd2, fd) < 0) rb_sys_fail(orig->path); |
