INN commit: branches/2.6 (4 files)

INN Commit rra at isc.org
Fri Nov 4 22:41:36 UTC 2016


    Date: Friday, November 4, 2016 @ 15:41:36
  Author: iulius
Revision: 10104

Update to latest upstream rra-c-util

Notably, change inet_ntoa replacement prototype to match POSIX.
While having a const arg and a const return value is more correct,
make the prototype of the replacement function exactly match POSIX
for fewer surprises when the replacement is used.

Modified:
  branches/2.6/include/portable/socket.h
  branches/2.6/lib/inet_ntoa.c
  branches/2.6/tests/lib/inet_ntoa-t.c
  branches/2.6/tests/lib/network/server-t.c

------------------------------+
 include/portable/socket.h    |    4 ++--
 lib/inet_ntoa.c              |    6 +++---
 tests/lib/inet_ntoa-t.c      |    2 +-
 tests/lib/network/server-t.c |   11 ++++++++++-
 4 files changed, 16 insertions(+), 7 deletions(-)

Modified: include/portable/socket.h
===================================================================
--- include/portable/socket.h	2016-11-04 22:41:03 UTC (rev 10103)
+++ include/portable/socket.h	2016-11-04 22:41:36 UTC (rev 10104)
@@ -218,10 +218,10 @@
 #endif
 #if !HAVE_DECL_INET_NTOA
 # if !HAVE_INET_NTOA
-extern const char *inet_ntoa(const struct in_addr)
+extern char *inet_ntoa(struct in_addr)
     __attribute__((__visibility__("hidden")));
 # else
-extern const char *inet_ntoa(const struct in_addr);
+extern char *inet_ntoa(struct in_addr);
 # endif
 #endif
 

Modified: lib/inet_ntoa.c
===================================================================
--- lib/inet_ntoa.c	2016-11-04 22:41:03 UTC (rev 10103)
+++ lib/inet_ntoa.c	2016-11-04 22:41:36 UTC (rev 10104)
@@ -32,11 +32,11 @@
 #if TESTING
 # undef inet_ntoa
 # define inet_ntoa test_inet_ntoa
-const char *test_inet_ntoa(const struct in_addr);
+char *test_inet_ntoa(struct in_addr);
 #endif
 
-const char *
-inet_ntoa(const struct in_addr in)
+char *
+inet_ntoa(struct in_addr in)
 {
     static char buf[16];
     const unsigned char *p;

Modified: tests/lib/inet_ntoa-t.c
===================================================================
--- tests/lib/inet_ntoa-t.c	2016-11-04 22:41:03 UTC (rev 10103)
+++ tests/lib/inet_ntoa-t.c	2016-11-04 22:41:36 UTC (rev 10104)
@@ -24,7 +24,7 @@
 
 #include "tap/basic.h"
 
-const char *test_inet_ntoa(const struct in_addr);
+char *test_inet_ntoa(struct in_addr);
 
 
 static void

Modified: tests/lib/network/server-t.c
===================================================================
--- tests/lib/network/server-t.c	2016-11-04 22:41:03 UTC (rev 10103)
+++ tests/lib/network/server-t.c	2016-11-04 22:41:36 UTC (rev 10104)
@@ -77,8 +77,17 @@
             close(fd);
             if (server == INVALID_SOCKET) {
                 close(client);
-                if (socket_errno == EAGAIN || socket_errno == EWOULDBLOCK)
+
+                /*
+                 * Written as two separate if statements because gcc with
+                 * -Werror=logical-op warns about identical expressions, and
+                 * EAGAIN and EWOULDBLOCK are the same number on Linux (but
+                 * not on some other platforms).
+                 */
+                if (socket_errno == EAGAIN)
                     return false;
+                if (socket_errno == EWOULDBLOCK)
+                    return false;
             } else {
                 close(server);
                 close(client);



More information about the inn-committers mailing list