From c17c8ebb1467cc78028cf2794f666d7493f46caf Mon Sep 17 00:00:00 2001 From: akr Date: Fri, 8 Jun 2012 10:57:10 +0000 Subject: [PATCH] * process.c (rb_exec_err): after_exec() call moved from proc_exec_cmd and proc_exec_sh. (rb_proc_exec): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35963 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ process.c | 11 +++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4b130eccbe..96b27f0555 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Fri Jun 8 19:43:33 2012 Tanaka Akira + + * process.c (rb_exec_err): after_exec() call moved from proc_exec_cmd and + proc_exec_sh. + (rb_proc_exec): ditto. + Fri Jun 8 19:00:59 2012 Tanaka Akira * process.c (ARGV_COUNT): unused macro removed. diff --git a/process.c b/process.c index 4b71998b99..0cb47228e2 100644 --- a/process.c +++ b/process.c @@ -1117,8 +1117,7 @@ proc_exec_cmd(const char *prog, VALUE argv_str, VALUE envp_str) execve(prog, argv, envp); /* async-signal-safe */ else execv(prog, argv); /* async-signal-safe */ - preserving_errno(try_with_sh(prog, argv, envp); /* try_with_sh() is async-signal-safe. */ - after_exec()); /* after_exec() is not async-signal-safe */ + preserving_errno(try_with_sh(prog, argv, envp)); /* try_with_sh() is async-signal-safe. */ # if defined(__EMX__) || defined(OS2) if (new_argv) { xfree(new_argv[0]); @@ -1148,7 +1147,6 @@ proc_exec_sh(const char *str, VALUE envp_str) #ifdef _WIN32 before_exec(); rb_w32_spawn(P_OVERLAY, (char *)str, 0); - after_exec(); return -1; #else #if defined(__CYGWIN32__) || defined(__EMX__) @@ -1161,7 +1159,6 @@ proc_exec_sh(const char *str, VALUE envp_str) execl(shell, "sh", "-c", str, (char *) NULL); else status = system(str); - after_exec(); if (status != -1) exit(status); } @@ -1171,7 +1168,6 @@ proc_exec_sh(const char *str, VALUE envp_str) execle("/bin/sh", "sh", "-c", str, (char *)NULL, (char **)RSTRING_PTR(envp_str)); /* async-signal-safe */ else execl("/bin/sh", "sh", "-c", str, (char *)NULL); /* async-signal-safe */ - preserving_errno(after_exec()); /* xxx: not async-signal-safe because after_exec calls rb_thread_start_timer_thread. */ #endif return -1; #endif /* _WIN32 */ @@ -1181,7 +1177,9 @@ proc_exec_sh(const char *str, VALUE envp_str) int rb_proc_exec(const char *str) { - return proc_exec_sh(str, Qfalse); + int ret = proc_exec_sh(str, Qfalse); + preserving_errno(after_exec()); + return ret; } enum { @@ -2615,6 +2613,7 @@ rb_exec_err(const struct rb_exec_arg *e, char *errmsg, size_t errmsg_buflen) #else # undef sargp #endif + preserving_errno(after_exec()); /* xxx: not async-signal-safe because after_exec calls rb_thread_start_timer_thread. */ return -1; }