From 7e6cecb76987cb1e61b20b1213dfd889ce8df930 Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 4 Dec 2003 21:57:35 +0000 Subject: * dln.c (aix_loaderror): should not use member named 'errno' which might be a macro (e.g. on AIX). * io.c (read_all): do not depend on lseek position. [ruby-dev:22026] * eval.c (rb_eval): preserve $! value when retry happens in the rescue clause. [ruby-talk:86697] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 15 +++++++++++++++ dln.c | 4 ++-- eval.c | 8 ++++---- io.c | 14 ++++++-------- 4 files changed, 27 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index e20cdec9ce..1e8418d517 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,21 @@ Fri Dec 5 02:49:35 2003 Nobuyoshi Nakada * lib/test/unit/assertions.rb (Test::Unit::Assertions::assert_nothing_raised): check whether arguments are subclass of Exception. +Thu Dec 4 23:54:00 2003 Rick Ohnemus + + * dln.c (aix_loaderror): should not use member named 'errno' which + might be a macro (e.g. on AIX). + +Thu Dec 4 23:32:26 2003 Yukihiro Matsumoto + + * io.c (read_all): do not depend on lseek position. + [ruby-dev:22026] + +Thu Dec 4 22:37:26 2003 Nobuyoshi Nakada + + * eval.c (rb_eval): preserve $! value when retry happens in the + rescue clause. [ruby-talk:86697] + Thu Dec 4 21:50:07 2003 Nobuyoshi Nakada * lib/drb/drb.rb (DRb::DRbMessage::send_request, send_reply): diff --git a/dln.c b/dln.c index 88f623d22c..be3e6c4b6b 100644 --- a/dln.c +++ b/dln.c @@ -1221,7 +1221,7 @@ aix_loaderror(const char *pathname) int i,j; struct errtab { - int errno; + int errnum; char *errstr; } load_errtab[] = { {L_ERROR_TOOMANY, "too many errors, rest skipped."}, @@ -1248,7 +1248,7 @@ aix_loaderror(const char *pathname) for(i = 0; message[i] && *message[i]; i++) { int nerr = atoi(message[i]); for (j=0; jnd_head); } else if (rescuing) { @@ -2864,11 +2865,10 @@ rb_eval(self, n) } else if (state == TAG_RETRY) { rescuing = state = 0; - e_info = ruby_errinfo = Qnil; - result = rb_eval(self, node->nd_head); + ruby_errinfo = e_info; + goto retry_entry; } else if (state != TAG_RAISE) { - ruby_errinfo = e_info; result = prot_tag->retval; } } @@ -2882,7 +2882,6 @@ rb_eval(self, n) state = 0; rescuing = 1; result = rb_eval(self, resq->nd_body); - ruby_errinfo = e_info; break; } resq = resq->nd_head; /* next rescue */ @@ -2892,6 +2891,7 @@ rb_eval(self, n) result = prot_tag->retval; } POP_TAG(); + if (state != TAG_RAISE) ruby_errinfo = e_info; if (state) { if (state == TAG_NEXT) prot_tag->retval = result; JUMP_TAG(state); diff --git a/io.c b/io.c index f0231567ba..639e207693 100644 --- a/io.c +++ b/io.c @@ -762,7 +762,7 @@ remain_size(fptr) ) { pos = io_tell(fptr); - if (st.st_size > pos && pos >= 0) { + if (st.st_size >= pos && pos >= 0) { siz = st.st_size - pos + 1; if (siz > LONG_MAX) { rb_raise(rb_eIOError, "file too big for single read"); @@ -780,25 +780,23 @@ read_all(fptr, siz, str) { long bytes = 0; long n; - off_t pos = 0; if (feof(fptr->f)) return Qnil; READ_CHECK(fptr->f); - if (!siz) siz = BUFSIZ; + if (siz == 0) siz = BUFSIZ; if (NIL_P(str)) { str = rb_tainted_str_new(0, siz); } else { rb_str_resize(str, siz); } - pos = io_tell(fptr); for (;;) { n = rb_io_fread(RSTRING(str)->ptr+bytes, siz-bytes, fptr->f); - if (pos > 0 && n == 0 && bytes == 0) { + if (n == 0 && bytes == 0) { rb_str_resize(str,0); - if (!fptr->f) return Qnil; - if (feof(fptr->f)) return Qnil; - if (!ferror(fptr->f)) return str; + if (!fptr->f) break; + if (feof(fptr->f)) break; + if (!ferror(fptr->f)) break; rb_sys_fail(fptr->path); } bytes += n; -- cgit v1.2.3