summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-04-30 07:37:38 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-04-30 07:37:38 +0000
commit7db098d2ad574e215a7553e68e57bb6fd7c8e5d5 (patch)
tree2859d1abc9503e91f80b9148c267adb04bfb2892
parent7bb12b8137f6de120bbe7033121eab91603de2c0 (diff)
downloadruby-7db098d2ad574e215a7553e68e57bb6fd7c8e5d5.tar.gz
merge revision(s) 45471: [Backport #9688]
* win32/win32.c (rb_w32_accept, open_ifs_socket, socketpair_internal): reset inherit flag of socket to avoid unintentional inheritance of socket. note that the return value of SetHandleInformation() is not verified intentionally because old Windows may return an error. [Bug #9688] [ruby-core:61754] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@45753 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog8
-rw-r--r--version.h2
-rw-r--r--win32/win32.c4
3 files changed, 13 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 35f10dee5d..05d7f5aa4d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Wed Apr 30 16:37:16 2014 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_accept, open_ifs_socket, socketpair_internal):
+ reset inherit flag of socket to avoid unintentional inheritance of
+ socket. note that the return value of SetHandleInformation() is not
+ verified intentionally because old Windows may return an error.
+ [Bug #9688] [ruby-core:61754]
+
Wed Apr 30 16:33:57 2014 Eric Wong <e@80x24.org>
* time.c (time_mload): freeze and preserve marshal-loaded time zone
diff --git a/version.h b/version.h
index f1ab57c68f..9a69bf4864 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.0.0"
#define RUBY_RELEASE_DATE "2014-04-30"
-#define RUBY_PATCHLEVEL 473
+#define RUBY_PATCHLEVEL 474
#define RUBY_RELEASE_YEAR 2014
#define RUBY_RELEASE_MONTH 4
diff --git a/win32/win32.c b/win32/win32.c
index c284194577..1dcad8693a 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -2917,6 +2917,7 @@ rb_w32_accept(int s, struct sockaddr *addr, int *addrlen)
if (fd != -1) {
r = accept(TO_SOCKET(s), addr, addrlen);
if (r != INVALID_SOCKET) {
+ SetHandleInformation((HANDLE)r, HANDLE_FLAG_INHERIT, 0);
MTHREAD_ONLY(EnterCriticalSection(&(_pioinfo(fd)->lock)));
_set_osfhnd(fd, r);
MTHREAD_ONLY(LeaveCriticalSection(&_pioinfo(fd)->lock));
@@ -3457,6 +3458,8 @@ open_ifs_socket(int af, int type, int protocol)
}
if (out == INVALID_SOCKET)
out = WSASocket(af, type, protocol, NULL, 0, 0);
+ if (out != INVALID_SOCKET)
+ SetHandleInformation((HANDLE)out, HANDLE_FLAG_INHERIT, 0);
}
free(proto_buffers);
@@ -3690,6 +3693,7 @@ socketpair_internal(int af, int type, int protocol, SOCKET *sv)
r = accept(svr, addr, &len);
if (r == INVALID_SOCKET)
break;
+ SetHandleInformation((HANDLE)r, HANDLE_FLAG_INHERIT, 0);
ret = 0;
} while (0);