From a94679135080615136be4d83a66b3f964b8d66a4 Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 16 Mar 1998 06:37:12 +0000 Subject: 1.1b9_03 pre2 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 14 ++++++++++++-- eval.c | 2 ++ io.c | 9 ++++++--- range.c | 3 +++ sig.h | 2 ++ signal.c | 19 +++++++++++++++++++ 6 files changed, 44 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6443744aee..1915ac4149 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,12 +1,22 @@ +Mon Mar 16 14:11:06 1998 Yukihiro Matsumoto + + * class.c (ins_methods_i): needed to consider NOEX_UNDEF. + Mon Mar 16 13:23:53 1998 WATANABE Hirofumi * io.c (io_check_closed): check for `fptr->f2 == NULL'. * io.c (io_fptr_close): ditto. -Mon Mar 16 14:11:06 1998 Yukihiro Matsumoto +Mon Mar 16 11:49:25 1998 Yukihiro Matsumoto - * class.c (ins_methods_i): needed to consider NOEX_UNDEF. + * io.c (pipe_atexit): free()ing referencing pipe_list. + + * range.c (range_length): returns zero, if the first is greater + than the last. + + * signal.c (trap_restore_mask): restore signal mask before raising + exceptions and throws. Fri Mar 13 13:49:24 1998 Yukihiro Matsumoto diff --git a/eval.c b/eval.c index a0efea26dc..5f053ab313 100644 --- a/eval.c +++ b/eval.c @@ -2622,6 +2622,7 @@ rb_longjmp(tag, mesg, at) str_freeze(errinfo); } + trap_restore_mask(); JUMP_TAG(tag); } @@ -6156,6 +6157,7 @@ f_throw(argc, argv) if (!tt) { NameError("uncaught throw `%s'", rb_id2name(t)); } + trap_restore_mask(); JUMP_TAG(TAG_THROW); /* not reached */ } diff --git a/io.c b/io.c index 7c086970f4..9f6e05bdd6 100644 --- a/io.c +++ b/io.c @@ -886,7 +886,7 @@ rb_fdopen(fd, mode) return f; } -#if defined (NT) || defined(DJGPP) || defined(__CYGWIN32__) || defined(__human68k__) || 1 +#if defined (NT) || defined(DJGPP) || defined(__CYGWIN32__) || defined(__human68k__) static struct pipe_list { OpenFile *fptr; struct pipe_list *next; @@ -913,6 +913,7 @@ pipe_del_fptr(fptr) if (list->fptr == fptr) { pipe_list = list->next; + free(list); return; } @@ -931,10 +932,12 @@ static void pipe_atexit() { struct pipe_list *list = pipe_list; + struct pipe_list *tmp; while (list) { + tmp = list->next; io_fptr_finalize(list->fptr); - list = list->next; + list = tmp; } } @@ -2500,7 +2503,7 @@ Init_IO() rb_define_virtual_variable("$-i", opt_i_get, opt_i_set); -#if defined (NT) || defined(DJGPP) || defined(__CYGWIN32__) || defined(__human68k__) || 1 +#if defined (NT) || defined(DJGPP) || defined(__CYGWIN32__) || defined(__human68k__) atexit(pipe_atexit); #endif diff --git a/range.c b/range.c index 74ac972668..fc5ae364e5 100644 --- a/range.c +++ b/range.c @@ -190,6 +190,9 @@ range_length(rng) first = rb_iv_get(rng, "first"); last = rb_iv_get(rng, "last"); + if (RTEST(rb_funcall(first, '>', 1, last))) { + return INT2FIX(0); + } if (!obj_is_kind_of(first, cNumeric)) { return enum_length(rng); } diff --git a/sig.h b/sig.h index ac4a4787f4..24a5160d37 100644 --- a/sig.h +++ b/sig.h @@ -20,6 +20,8 @@ extern int prohibit_interrupt; #define ENABLE_INTS {prohibit_interrupt--;} extern int trap_pending; +void trap_restore_mask _((void)); + #ifdef THREAD extern int thread_critical; #if defined(HAVE_SETITIMER) && !defined(__BOW__) diff --git a/signal.c b/signal.c index e5621b4ec1..f518d597e0 100644 --- a/signal.c +++ b/signal.c @@ -358,6 +358,12 @@ struct trap_arg { VALUE sig, cmd; }; +# ifdef HAVE_SIGPROCMASK +static sigset_t trap_last_mask; +# else +static int trap_last_mask; +# endif + static RETSIGTYPE sigexit() { @@ -476,9 +482,22 @@ trap_ensure(arg) #else sigsetmask(arg->mask); #endif + trap_last_mask = arg->mask; } #endif +void +trap_restore_mask() +{ +#ifndef NT +# ifdef HAVE_SIGPROCMASK + sigprocmask(SIG_SETMASK, &trap_last_mask, NULL); +# else + sigsetmask(trap_last_mask); +# endif +#endif +} + static VALUE f_trap(argc, argv) int argc; -- cgit v1.2.3