ruby-changes:24083
From: nobu <ko1@a...>
Date: Tue, 19 Jun 2012 17:52:08 +0900 (JST)
Subject: [ruby-changes:24083] nobu:r36134 (trunk): process.c: no method calls in async-signal-safe
nobu 2012-06-19 17:51:57 +0900 (Tue, 19 Jun 2012) New Revision: 36134 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36134 Log: process.c: no method calls in async-signal-safe * process.c (rb_execarg_run_options): do not call any methods in the async-signal-safe function. mask has been checked with NUM2MODET() already and converted with LONG2NUM(). Modified files: trunk/ChangeLog trunk/process.c Index: ChangeLog =================================================================== --- ChangeLog (revision 36133) +++ ChangeLog (revision 36134) @@ -1,3 +1,9 @@ +Tue Jun 19 17:51:54 2012 Nobuyoshi Nakada <nobu@r...> + + * process.c (rb_execarg_run_options): do not call any methods in the + async-signal-safe function. mask has been checked with NUM2MODET() + already and converted with LONG2NUM(). + Tue Jun 19 11:59:56 2012 NARUSE, Yui <naruse@r...> * ext/readline/readline.c (Init_readline): don't set 0 to Index: process.c =================================================================== --- process.c (revision 36133) +++ process.c (revision 36134) @@ -17,6 +17,8 @@ #include "internal.h" #include "vm_core.h" +#define STATIC_ASSERT(name, expr) typedef int static_assert_##name##_check[1 - 2*!(expr)] + #include <stdio.h> #include <errno.h> #include <signal.h> @@ -1595,6 +1597,7 @@ hide_obj(rb_str_dup(val))); } else if (id == rb_intern("umask")) { + STATIC_ASSERT(sizeof_mode_t, sizeof(long) >= sizeof(mode_t)); /* for LONG2NUM */ mode_t cmask = NUM2MODET(val); if (!NIL_P(rb_ary_entry(options, EXEC_OPTION_UMASK))) { rb_raise(rb_eArgError, "umask option specified twice"); @@ -2707,7 +2710,7 @@ obj = rb_ary_entry(options, EXEC_OPTION_UMASK); if (!NIL_P(obj)) { - mode_t mask = NUM2MODET(obj); + mode_t mask = (mode_t)FIX2LONG(obj); /* no method calls */ mode_t oldmask = umask(mask); /* never fail */ /* async-signal-safe */ if (!NIL_P(soptions)) rb_ary_store(soptions, EXEC_OPTION_UMASK, MODET2NUM(oldmask)); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/