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

source_changes at macosforge.org source_changes at macosforge.org
Tue Jul 21 16:35:12 PDT 2009


Revision: 2044
          http://trac.macosforge.org/projects/ruby/changeset/2044
Author:   pthomson at apple.com
Date:     2009-07-21 16:35:12 -0700 (Tue, 21 Jul 2009)
Log Message:
-----------
Fixed a pretty severe bug in IO#ioctl. (But if you're actually using ioctl, you're insane.)

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

Modified: MacRuby/branches/experimental/io.c
===================================================================
--- MacRuby/branches/experimental/io.c	2009-07-21 22:28:52 UTC (rev 2043)
+++ MacRuby/branches/experimental/io.c	2009-07-21 23:35:12 UTC (rev 2044)
@@ -3343,18 +3343,18 @@
 }
 // Here be dragons.
 static VALUE
-rb_io_ctl(VALUE io, VALUE req, VALUE arg, int is_io)
+rb_io_ctl(VALUE io, VALUE arg, VALUE req, int is_io)
 {
+	unsigned long request;
+    unsigned long cmd = NUM2ULONG(arg);
     rb_io_t *io_s = ExtractIOStruct(io);
     if (TYPE(req) == T_STRING) {
-	rb_bug("ioctl doesn't support strings yet...\n");
-	return INT2FIX(0);
-    }
-    unsigned long cmd = NUM2ULONG(req);
-
-    int retval = is_io ? ioctl(io_s->fd, cmd) : fcntl(io_s->fd, cmd);
-
-    return retval;
+		request = (unsigned long)(intptr_t)RSTRING_PTR(req);
+    } else {
+		request = FIX2ULONG(req);
+	}
+    int retval = is_io ? ioctl(io_s->fd, cmd, request) : fcntl(io_s->fd, cmd, request);
+    return INT2FIX(retval);
 }
 
 /*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090721/83c341b3/attachment.html>


More information about the macruby-changes mailing list