Skip to content

Commit

Permalink
rb_io_seek should not require readability
Browse files Browse the repository at this point in the history
rb_io_seek should be usable on write-only and read-only IO, not just read-able IO



git-svn-id: http://svn.macosforge.org/repository/ruby/MacRuby/trunk@3894 23306eb0-4c56-4727-a40e-e92c0eb68959
  • Loading branch information
Thibault Martin-Lagardette committed Mar 30, 2010
1 parent aeafee7 commit 02ec0fd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions io.c
Original file line number Diff line number Diff line change
Expand Up @@ -558,12 +558,12 @@ static VALUE
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");
}
Expand Down

0 comments on commit 02ec0fd

Please sign in to comment.