1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

init.c: declaration-after-statement

* ext/socket/init.c (cloexec_accept): fix declaration-after-statement.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2013-02-04 06:19:40 +00:00
parent 523292d612
commit a9cbe8c721

View file

@ -482,9 +482,11 @@ cloexec_accept(int socket, struct sockaddr *address, socklen_t *address_len)
{
int ret;
socklen_t len0 = 0;
if (address_len) len0 = *address_len;
#ifdef HAVE_ACCEPT4
static int try_accept4 = 1;
#endif
if (address_len) len0 = *address_len;
#ifdef HAVE_ACCEPT4
if (try_accept4) {
ret = accept4(socket, address, address_len, SOCK_CLOEXEC);
/* accept4 is available since Linux 2.6.28, glibc 2.10. */
@ -494,17 +496,13 @@ cloexec_accept(int socket, struct sockaddr *address, socklen_t *address_len)
if (address_len && len0 < *address_len) *address_len = len0;
return ret;
}
if (errno == ENOSYS) {
if (errno != ENOSYS) {
return -1;
}
try_accept4 = 0;
ret = accept(socket, address, address_len);
}
}
else {
ret = accept(socket, address, address_len);
}
#else
ret = accept(socket, address, address_len);
#endif
ret = accept(socket, address, address_len);
if (ret == -1) return -1;
if (address_len && len0 < *address_len) *address_len = len0;
rb_maygvl_fd_fix_cloexec(ret);