summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-07 17:55:45 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-07 17:55:45 +0000
commit4c1e0db035879683aff84782738b69078c2bb3d5 (patch)
tree9318c9a5c20e31a8b99504508332081a20e020de /io.c
parentd40bafa47ec2541ea5c3a633e1d475292f0874dd (diff)
merge revision(s) 13774:
* io.c (rb_io_tell, rb_io_seek): check errno too. [ruby-dev:32093] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@16911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/io.c b/io.c
index 8f8dfcdf2e..088b678c51 100644
--- a/io.c
+++ b/io.c
@@ -245,6 +245,7 @@ flush_before_seek(fptr)
if (fptr->mode & FMODE_WBUF) {
io_fflush(GetWriteFile(fptr), fptr);
}
+ errno = 0;
return fptr;
}
@@ -668,7 +669,7 @@ rb_io_tell(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);
}
@@ -683,7 +684,7 @@ rb_io_seek(io, offset, 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);
clearerr(fptr->f);
return INT2FIX(0);