[macruby-changes] [2111] MacRuby/branches/experimental/io.c

source_changes at macosforge.org source_changes at macosforge.org
Wed Jul 29 02:01:26 PDT 2009


Revision: 2111
          http://trac.macosforge.org/projects/ruby/changeset/2111
Author:   lsansonetti at apple.com
Date:     2009-07-29 02:01:25 -0700 (Wed, 29 Jul 2009)
Log Message:
-----------
fixed a bug in IO#reopen

Modified Paths:
--------------
    MacRuby/branches/experimental/io.c

Modified: MacRuby/branches/experimental/io.c
===================================================================
--- MacRuby/branches/experimental/io.c	2009-07-29 08:59:10 UTC (rev 2110)
+++ MacRuby/branches/experimental/io.c	2009-07-29 09:01:25 UTC (rev 2111)
@@ -1410,11 +1410,7 @@
 {
     rb_io_t *io_s = ExtractIOStruct(io);
     rb_io_assert_open(io_s);
-    line_no = rb_check_to_integer(line_no, "to_int");
-    if (NIL_P(line_no)) {
-	rb_raise(rb_eTypeError, "lineno's argument must be coercable to integer");
-    }
-    io_s->lineno = FIX2INT(line_no);
+    io_s->lineno = NUM2INT(line_no);
     return line_no;
 }
 
@@ -2440,6 +2436,7 @@
 		    "cannot reopen from non file descriptor based IO");
 	}
 
+	int fd = io_s->fd;
 	if (io_s->should_close_streams) {
 	    io_struct_close(io_s, true, true);
 	}
@@ -2451,7 +2448,7 @@
 		CFRetain(io_s->writeStream);
 	    }
 	}
-	int fd = dup2(other->fd, io_s->fd);
+	fd = dup2(other->fd, fd);
 	if (fd < 0) {
 	    rb_sys_fail("dup2() failed");
 	}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090729/be1fc547/attachment-0001.html>


More information about the macruby-changes mailing list