summaryrefslogtreecommitdiff
path: root/process.c
diff options
context:
space:
mode:
authorngoto <ngoto@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-16 12:08:56 (GMT)
committerngoto <ngoto@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-16 12:08:56 (GMT)
commitdb2fe4b8ef549c0794a54178a3e6b2bdd88a6291 (patch)
tree66e36c8fcc7c25f3487dec04a61c4a8c889c7f23 /process.c
parentb3e9fce0367c3a16755efeff23c6df08ee19d81d (diff)
Revert r51209 because signals after stopping timer thread before
entering exec(2) system call may be lost. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51265 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'process.c')
-rw-r--r--process.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/process.c b/process.c
index 708cea9..7d3b1f5 100644
--- a/process.c
+++ b/process.c
@@ -2484,7 +2484,9 @@ rb_execarg_parent_end(VALUE execarg_obj)
RB_GC_GUARD(execarg_obj);
}
+#if defined(__APPLE__) || defined(__HAIKU__)
static int rb_exec_without_timer_thread(const struct rb_execarg *eargp, char *errmsg, size_t errmsg_buflen);
+#endif
/*
* call-seq:
@@ -2572,7 +2574,13 @@ rb_f_exec(int argc, const VALUE *argv)
rb_execarg_parent_start(execarg_obj);
fail_str = eargp->use_shell ? eargp->invoke.sh.shell_script : eargp->invoke.cmd.command_name;
+#if defined(__APPLE__) || defined(__HAIKU__)
rb_exec_without_timer_thread(eargp, errmsg, sizeof(errmsg));
+#else
+ before_exec_async_signal_safe(); /* async-signal-safe */
+ rb_exec_async_signal_safe(eargp, errmsg, sizeof(errmsg));
+ preserving_errno(after_exec_async_signal_safe()); /* async-signal-safe */
+#endif
RB_GC_GUARD(execarg_obj);
if (errmsg[0])
rb_sys_fail(errmsg);
@@ -3080,6 +3088,7 @@ failure:
return -1;
}
+#if defined(__APPLE__) || defined(__HAIKU__)
static int
rb_exec_without_timer_thread(const struct rb_execarg *eargp, char *errmsg, size_t errmsg_buflen)
{
@@ -3089,6 +3098,7 @@ rb_exec_without_timer_thread(const struct rb_execarg *eargp, char *errmsg, size_
preserving_errno(after_exec()); /* not async-signal-safe because it calls rb_thread_start_timer_thread. */
return ret;
}
+#endif
#ifdef HAVE_WORKING_FORK
/* This function should be async-signal-safe. Hopefully it is. */