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

ruby-changes:21570

From: nagachika <ko1@a...>
Date: Thu, 3 Nov 2011 22:14:59 +0900 (JST)
Subject: [ruby-changes:21570] nagachika:r33619 (trunk): * ext/socket/init.c (rsock_socket): set close-on-exec flag when

nagachika	2011-11-03 22:14:48 +0900 (Thu, 03 Nov 2011)

  New Revision: 33619

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

  Log:
    * ext/socket/init.c (rsock_socket): set close-on-exec flag when
      SOCK_CLOEXEC is not available.

  Modified files:
    trunk/ChangeLog
    trunk/ext/socket/init.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 33618)
+++ ChangeLog	(revision 33619)
@@ -1,3 +1,8 @@
+Thu Nov  3 22:12:41 2011  CHIKANAGA Tomoyuki  <nagachika00@g...>
+
+	* ext/socket/init.c (rsock_socket): set close-on-exec flag when
+	  SOCK_CLOEXEC is not available.
+
 Thu Nov 03 08:36:00 2011  Martin Bosslet  <Martin.Bosslet@g...>
 
 	* test/openssl/test_engine.rb: call Engine::cleanup on exit.
Index: ext/socket/init.c
===================================================================
--- ext/socket/init.c	(revision 33618)
+++ ext/socket/init.c	(revision 33619)
@@ -270,8 +270,16 @@
 	    fd = socket(domain, type, proto);
 	}
     }
+#ifdef SOCK_CLOEXEC
     if (0 <= fd)
-        rb_update_max_fd(fd);
+	if (try_sock_cloexec)
+	    rb_update_max_fd(fd);
+	else
+	    rb_fd_fix_cloexec(fd);
+#else
+    if (0 <= fd)
+	rb_fd_fix_cloexec(fd);
+#endif
     return fd;
 }
 

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

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