From 3e1c383e455ec9fb938e6d85b353f648d516a0de Mon Sep 17 00:00:00 2001 From: michal Date: Wed, 23 Jun 2004 13:18:32 +0000 Subject: [PATCH] io_seek()'s retval should be checked [ruby-core:03045] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 +++++- io.c | 10 +++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 18fa55d4e7..50c3f1689a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,8 @@ -Wed Jun 23 21:48:27 2004 Michal Rokos +Wed Jun 23 22:16:16 2004 Michal Rokos + + * io.c: io_seek()'s retval should be checked [ruby-core:03045] + +Wed Jun 23 21:48:27 2004 Michal Rokos * time.c: Fix indentation. diff --git a/io.c b/io.c index d26aaaf1cd..f066099f5d 100644 --- a/io.c +++ b/io.c @@ -161,7 +161,7 @@ extern int ReadDataPending(); #define READ_CHECK(fp) do {\ if (!READ_DATA_PENDING(fp)) {\ rb_thread_wait_fd(fileno(fp));\ - rb_io_check_closed(fptr);\ + rb_io_check_closed(fptr);\ }\ } while(0) @@ -3176,8 +3176,12 @@ io_reopen(io, nfile) } rb_thread_fd_close(fd); if ((orig->mode & FMODE_READABLE) && pos >= 0) { - io_seek(fptr, pos, SEEK_SET); - io_seek(orig, pos, SEEK_SET); + if (io_seek(fptr, pos, SEEK_SET) < 0) { + rb_sys_fail(fptr->path); + } + if (io_seek(orig, pos, SEEK_SET) < 0) { + rb_sys_fail(orig->path); + } } }