[前][次][番号順一覧][スレッド一覧]

ruby-changes:23918

From: akr <ko1@a...>
Date: Sat, 9 Jun 2012 01:26:11 +0900 (JST)
Subject: [ruby-changes:23918] akr:r35969 (trunk): * process.c (rb_exec_err): before_exec() call moved from proc_exec_cmd

akr	2012-06-09 01:26:01 +0900 (Sat, 09 Jun 2012)

  New Revision: 35969

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=35969

  Log:
    * process.c (rb_exec_err): before_exec() call moved from proc_exec_cmd
      and proc_exec_sh.
      (rb_proc_exec): ditto.

  Modified files:
    trunk/ChangeLog
    trunk/process.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 35968)
+++ ChangeLog	(revision 35969)
@@ -1,3 +1,9 @@
+Sat Jun  9 01:24:28 2012  Tanaka Akira  <akr@f...>
+
+	* process.c (rb_exec_err): before_exec() call moved from proc_exec_cmd
+	  and proc_exec_sh.
+	  (rb_proc_exec): ditto.
+
 Sat Jun  9 01:11:07 2012  Tanaka Akira  <akr@f...>
 
 	* include/ruby/intern.h (rb_exec_arg_init): declaration changed to
@@ -20,8 +26,8 @@
 
 Fri Jun  8 19:43:33 2012  Tanaka Akira  <akr@f...>
 
-	* process.c (rb_exec_err): after_exec() call moved from proc_exec_cmd and
-	  proc_exec_sh.
+	* 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  <akr@f...>
Index: process.c
===================================================================
--- process.c	(revision 35968)
+++ process.c	(revision 35969)
@@ -1111,7 +1111,6 @@
 	}
     }
 # endif /* __EMX__ */
-    before_exec(); /* async-signal-safe if forked_child is true */
     envp = envp_str ? (char **)RSTRING_PTR(envp_str) : NULL;
     if (envp_str)
         execve(prog, argv, envp); /* async-signal-safe */
@@ -1136,6 +1135,7 @@
     rb_notimplement();
     UNREACHABLE;
 #else
+
     while (*str == ' ' || *str == '\t' || *str == '\n')
 	str++;
 
@@ -1145,7 +1145,6 @@
     }
 
 #ifdef _WIN32
-    before_exec();
     rb_w32_spawn(P_OVERLAY, (char *)str, 0);
     return -1;
 #else
@@ -1154,7 +1153,6 @@
         char fbuf[MAXPATHLEN];
         char *shell = dln_find_exe_r("sh", 0, fbuf, sizeof(fbuf));
         int status = -1;
-        before_exec();
         if (shell)
             execl(shell, "sh", "-c", str, (char *) NULL);
         else
@@ -1163,7 +1161,6 @@
             exit(status);
     }
 #else
-    before_exec(); /* async-signal-safe if forked_child is true. */
     if (envp_str)
         execle("/bin/sh", "sh", "-c", str, (char *)NULL, (char **)RSTRING_PTR(envp_str)); /* async-signal-safe */
     else
@@ -2596,8 +2593,10 @@
 # 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 */
-        return -1;
+        goto failure;
     }
 
     if (e->use_shell) {
@@ -2614,6 +2613,7 @@
 #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;
 }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]