diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-10-25 05:19:33 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-10-25 05:19:33 +0000 |
commit | bb053cd8242aa3794ad24f9a2aab5d9fcd4907b0 (patch) | |
tree | ea31b5eab1be341307045fe22b1e202a8830a126 /io.c | |
parent | 966e15e655098152eb9b66d18bd43f7de9061550 (diff) | |
download | ruby-bb053cd8242aa3794ad24f9a2aab5d9fcd4907b0.tar.gz |
* io.c (rb_io_tell, rb_io_seek): check errno too. [ruby-dev:32093]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13774 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -318,6 +318,7 @@ flush_before_seek(rb_io_t *fptr) { io_fflush(fptr); io_unread(fptr); + errno = 0; return fptr; } @@ -780,7 +781,7 @@ rb_io_tell(VALUE io) GetOpenFile(io, fptr); pos = io_tell(fptr); - if (pos < 0) rb_sys_fail(fptr->path); + if (pos < 0 && errno) rb_sys_fail(fptr->path); return OFFT2NUM(pos); } @@ -793,7 +794,7 @@ rb_io_seek(VALUE io, VALUE offset, int whence) pos = NUM2OFFT(offset); GetOpenFile(io, fptr); pos = io_seek(fptr, pos, whence); - if (pos < 0) rb_sys_fail(fptr->path); + if (pos < 0 && errno) rb_sys_fail(fptr->path); return INT2FIX(0); } |