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

ruby-changes:26988

From: nobu <ko1@a...>
Date: Mon, 4 Feb 2013 15:24:04 +0900 (JST)
Subject: [ruby-changes:26988] nobu:r39040 (trunk): init.c: declaration-after-statement

nobu	2013-02-04 15:19:40 +0900 (Mon, 04 Feb 2013)

  New Revision: 39040

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

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

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

Index: ext/socket/init.c
===================================================================
--- ext/socket/init.c	(revision 39039)
+++ ext/socket/init.c	(revision 39040)
@@ -482,9 +482,11 @@ cloexec_accept(int socket, struct sockad https://github.com/ruby/ruby/blob/trunk/ext/socket/init.c#L482
 {
     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 sockad https://github.com/ruby/ruby/blob/trunk/ext/socket/init.c#L496
             if (address_len && len0 < *address_len) *address_len = len0;
             return ret;
         }
-        if (errno == ENOSYS) {
-            try_accept4 = 0;
-            ret = accept(socket, address, address_len);
+        if (errno != ENOSYS) {
+            return -1;
         }
+        try_accept4 = 0;
     }
-    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);

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

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