[macruby-changes] [2640] MacRuby/trunk/io.c

source_changes at macosforge.org source_changes at macosforge.org
Fri Sep 25 14:11:29 PDT 2009


Revision: 2640
          http://trac.macosforge.org/projects/ruby/changeset/2640
Author:   lsansonetti at apple.com
Date:     2009-09-25 14:11:29 -0700 (Fri, 25 Sep 2009)
Log Message:
-----------
fix for <rdar://problem/7252633> open crashes when mode is numeric

Modified Paths:
--------------
    MacRuby/trunk/io.c

Modified: MacRuby/trunk/io.c
===================================================================
--- MacRuby/trunk/io.c	2009-09-25 20:52:03 UTC (rev 2639)
+++ MacRuby/trunk/io.c	2009-09-25 21:11:29 UTC (rev 2640)
@@ -175,6 +175,10 @@
 static int
 convert_mode_string_to_oflags(VALUE s) 
 {
+    if (TYPE(s) == T_FIXNUM) {
+	return NUM2INT(s);
+    }
+    StringValue(s);
     return convert_fmode_to_oflags(convert_mode_string_to_fmode(s));
 }
 
@@ -2270,7 +2274,7 @@
        }
     }
     rb_io_t *io_struct = ExtractIOStruct(io);
-    prepare_io_from_fd(io_struct, fd, convert_mode_string_to_fmode(modes));
+    prepare_io_from_fd(io_struct, fd, convert_oflags_to_fmode(flags));
     GC_WB(&io_struct->path, path); 
     return io;
 }
@@ -2299,7 +2303,6 @@
     return io;
 }
 
-
 /*
  *  call-seq:
  *     IO.sysopen(path, [mode, [perm]])  => fixnum
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090925/42b116a9/attachment.html>


More information about the macruby-changes mailing list