ruby-changes:23931
From: akr <ko1@a...>
Date: Sat, 9 Jun 2012 10:57:55 +0900 (JST)
Subject: [ruby-changes:23931] akr:r35982 (trunk): * process.c (rb_exec_async_signal_safe): extracted from rb_exec_err.
akr 2012-06-09 10:57:46 +0900 (Sat, 09 Jun 2012) New Revision: 35982 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=35982 Log: * process.c (rb_exec_async_signal_safe): extracted from rb_exec_err. Modified files: trunk/ChangeLog trunk/process.c Index: ChangeLog =================================================================== --- ChangeLog (revision 35981) +++ ChangeLog (revision 35982) @@ -1,3 +1,7 @@ +Sat Jun 9 10:57:14 2012 Tanaka Akira <akr@f...> + + * process.c (rb_exec_async_signal_safe): extracted from rb_exec_err. + Sat Jun 9 09:31:07 2012 Tanaka Akira <akr@f...> * process.c: simplified because close_others option is always Index: process.c =================================================================== --- process.c (revision 35981) +++ process.c (revision 35982) @@ -2583,9 +2583,9 @@ return rb_run_exec_options_err(e, s, NULL, 0); } -/* This function should be async-signal-safe. Actually it isn't because after_exec(). */ -int -rb_exec_err(const struct rb_exec_arg *e, char *errmsg, size_t errmsg_buflen) +/* This function should be async-signal-safe. Actually it is. */ +static int +rb_exec_async_signal_safe(const struct rb_exec_arg *e, char *errmsg, size_t errmsg_buflen) { #if !defined(HAVE_FORK) struct rb_exec_arg sarg, *sargp = &sarg; @@ -2593,10 +2593,8 @@ # define sargp NULL #endif - before_exec(); /* async-signal-safe if forked_child is true */ - if (rb_run_exec_options_err(e, sargp, errmsg, errmsg_buflen) < 0) { /* async-signal-safe */ - goto failure; + return -1; } if (e->use_shell) { @@ -2613,12 +2611,20 @@ #else # undef sargp #endif -failure: - preserving_errno(after_exec()); /* xxx: not async-signal-safe because after_exec calls rb_thread_start_timer_thread. */ return -1; } int +rb_exec_err(const struct rb_exec_arg *e, char *errmsg, size_t errmsg_buflen) +{ + int ret; + before_exec(); /* async-signal-safe if forked_child is true */ + ret = rb_exec_async_signal_safe(e, errmsg, errmsg_buflen); + preserving_errno(after_exec()); /* not async-signal-safe because after_exec calls rb_thread_start_timer_thread. */ + return ret; +} + +int rb_exec(const struct rb_exec_arg *e) { #if !defined FD_CLOEXEC && !defined HAVE_SPAWNV -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/