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

ruby-changes:23884

From: usa <ko1@a...>
Date: Wed, 6 Jun 2012 12:39:51 +0900 (JST)
Subject: [ruby-changes:23884] usa:r35935 (trunk): * process.c (rb_run_exec_options_err): allocate a temporary buffer for

usa	2012-06-06 12:39:40 +0900 (Wed, 06 Jun 2012)

  New Revision: 35935

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

  Log:
    * process.c (rb_run_exec_options_err): allocate a temporary buffer for
      run_exec_dup2() for restoring fds on non-fork environments.

  Modified files:
    trunk/ChangeLog
    trunk/process.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 35934)
+++ ChangeLog	(revision 35935)
@@ -1,3 +1,8 @@
+Wed Jun  6 12:37:43 2012  NAKAMURA Usaku  <usa@r...>
+
+	* process.c (rb_run_exec_options_err): allocate a temporary buffer for
+	  run_exec_dup2() for restoring fds on non-fork environments.
+
 Wed Jun  6 09:45:21 2012  NAKAMURA Usaku  <usa@r...>
 
 	* test/dl/test_c_{struct_entry,union_entity}.rb: sorry, typos.
Index: process.c
===================================================================
--- process.c	(revision 35934)
+++ process.c	(revision 35935)
@@ -2460,6 +2460,7 @@
         return 0;
 
     if (s) {
+        /* assume that s is always NULL on fork-able environments */
         s->options = soptions = hide_obj(rb_ary_new());
         s->redirect_fds = Qnil;
 	s->envp_str = s->envp_buf = 0;
@@ -2561,6 +2562,16 @@
         }
     }
 
+    if (s) {
+        VALUE ary = rb_ary_entry(s->options, EXEC_OPTION_DUP2);
+        if (!NIL_P(ary)) {
+            size_t len = run_exec_dup2_tmpbuf_size(RARRAY_LEN(ary));
+            VALUE tmpbuf = hide_obj(rb_str_new(0, len));
+            rb_str_set_len(tmpbuf, len);
+            s->dup2_tmpbuf = tmpbuf;
+        }
+    }
+
     return 0;
 }
 

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

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