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

ruby-changes:26632

From: yugui <ko1@a...>
Date: Fri, 4 Jan 2013 00:39:22 +0900 (JST)
Subject: [ruby-changes:26632] yugui:r38683 (trunk): * io.c (rb_cloexec_fcntl_dupfd): Fix failures in

yugui	2013-01-04 00:39:10 +0900 (Fri, 04 Jan 2013)

  New Revision: 38683

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

  Log:
    * io.c (rb_cloexec_fcntl_dupfd): Fix failures in
      bootstrap_test/test_io.rb.  NativeClient does not support F_DUPFD
      but supports dup2(2).

  Modified files:
    trunk/ChangeLog
    trunk/io.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 38682)
+++ ChangeLog	(revision 38683)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Jan  4 00:29:40 2013  Yuki Yugui Sonoda  <yugui@y...>
+
+	* io.c (rb_cloexec_fcntl_dupfd): Fix failures in
+	  bootstrap_test/test_io.rb.  NativeClient does not support F_DUPFD
+	  but supports dup2(2).
+
 Thu Jan  3 17:46:50 2013  Kouhei Sutou  <kou@c...>
 
 	* lib/rexml/element.rb (REXML::Elements#add): Remove too much
Index: io.c
===================================================================
--- io.c	(revision 38682)
+++ io.c	(revision 38683)
@@ -298,7 +298,7 @@ rb_cloexec_fcntl_dupfd(int fd, int minfd https://github.com/ruby/ruby/blob/trunk/io.c#L298
 {
     int ret;
 
-#if defined(HAVE_FCNTL) && defined(F_DUPFD_CLOEXEC)
+#if defined(HAVE_FCNTL) && defined(F_DUPFD_CLOEXEC) && !defined(__native_client__)
     static int try_dupfd_cloexec = 1;
     if (try_dupfd_cloexec) {
         ret = fcntl(fd, F_DUPFD_CLOEXEC, minfd);
@@ -318,8 +318,10 @@ rb_cloexec_fcntl_dupfd(int fd, int minfd https://github.com/ruby/ruby/blob/trunk/io.c#L318
     else {
         ret = fcntl(fd, F_DUPFD, minfd);
     }
-#else
+#elif defined(HAVE_FCNTL) && !defined(__native_client__)
     ret = fcntl(fd, F_DUPFD, minfd);
+#else
+    ret = dup2(fd, minfd);
 #endif
     if (ret == -1) return -1;
     rb_maygvl_fd_fix_cloexec(ret);

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

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