* ext/socket/socket.c (rsock_socketpair0): refactored.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2011-11-05 09:06:05 +00:00
parent 385a7d4594
commit a3521e0261
2 changed files with 12 additions and 10 deletions

View File

@ -1,3 +1,7 @@
Sat Nov 5 18:05:12 2011 Tanaka Akira <akr@fsij.org>
* ext/socket/socket.c (rsock_socketpair0): refactored.
Sat Nov 5 17:55:52 2011 Tanaka Akira <akr@fsij.org>
* ext/socket/init.c (rsock_socket0): don't clear try_sock_cloexec if

View File

@ -86,9 +86,8 @@ rsock_socketpair0(int domain, int type, int protocol, int sv[2])
static int try_sock_cloexec = 1;
if (try_sock_cloexec) {
ret = socketpair(domain, type|SOCK_CLOEXEC, protocol, sv);
if (ret == -1) {
if (ret == -1 && errno == EINVAL) {
/* SOCK_CLOEXEC is available since Linux 2.6.27. Linux 2.6.18 fails with EINVAL */
if (try_sock_cloexec && errno == EINVAL) {
ret = socketpair(domain, type, protocol, sv);
if (ret != -1) {
/* The reason of EINVAL may be other than SOCK_CLOEXEC.
@ -99,7 +98,6 @@ rsock_socketpair0(int domain, int type, int protocol, int sv[2])
}
}
}
}
else {
ret = socketpair(domain, type, protocol, sv);
}