Revision
3894
Author
martinlagardette@apple.com
Date
2010-03-29 18:05:57 -0700 (Mon, 29 Mar 2010)

Log Message

rb_io_seek should not require readability

rb_io_seek should be usable on write-only and read-only IO, not just read-able IO

Modified Paths

Diff

Modified: MacRuby/trunk/io.c (3893 => 3894)


--- MacRuby/trunk/io.c	2010-03-30 00:21:36 UTC (rev 3893)
+++ MacRuby/trunk/io.c	2010-03-30 01:05:57 UTC (rev 3894)
@@ -558,12 +558,12 @@
 rb_io_seek(VALUE io, VALUE offset, int whence)
 {
     rb_io_t *io_struct = ExtractIOStruct(io);
-    rb_io_assert_readable(io_struct);
+    rb_io_check_closed(io_struct);
     off_t off = NUM2OFFT(offset);
 //    if (whence == SEEK_CUR) {
 //	off += ltell(io_struct->read_fd);
 //    }
-    const off_t code = lseek(io_struct->read_fd, off, whence);
+    const off_t code = lseek(io_struct->fd, off, whence);
     if (code == -1) {
 	rb_sys_fail("lseek() failed");
     }