[macruby-changes] [4893] MacRuby/trunk/io.c
source_changes at macosforge.org
source_changes at macosforge.org
Sat Nov 6 07:48:18 PDT 2010
Revision: 4893
http://trac.macosforge.org/projects/ruby/changeset/4893
Author: watson1978 at gmail.com
Date: 2010-11-06 07:48:14 -0700 (Sat, 06 Nov 2010)
Log Message:
-----------
IO#dup and IO#binmode will raise an IOError exception with the closed stream.
Test Script:
{{{
require 'test/unit/assertions.rb'
include Test::Unit::Assertions
r, w = IO.pipe
w.close
assert_raise(IOError) { w.binmode }
assert_raise(IOError) { w2 = w.dup }
puts :ok
}}}
Modified Paths:
--------------
MacRuby/trunk/io.c
Modified: MacRuby/trunk/io.c
===================================================================
--- MacRuby/trunk/io.c 2010-11-06 02:04:14 UTC (rev 4892)
+++ MacRuby/trunk/io.c 2010-11-06 14:48:14 UTC (rev 4893)
@@ -2140,6 +2140,8 @@
rb_io_binmode(VALUE io, SEL sel)
{
// binmode does nothing on Mac OS X
+ rb_io_t *io_struct = ExtractIOStruct(io);
+ rb_io_check_closed(io_struct);
return io;
}
@@ -2650,6 +2652,7 @@
rb_io_t *dest_io = ExtractIOStruct(dest);
rb_io_t *origin_io = ExtractIOStruct(origin);
+ rb_io_check_closed(origin_io);
if (dest_io == origin_io) {
return dest;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20101106/856405b7/attachment.html>
More information about the macruby-changes
mailing list