INN commit: trunk (4 files)

INN Commit rra at isc.org
Wed Aug 17 13:28:54 UTC 2016


    Date: Wednesday, August 17, 2016 @ 06:28:53
  Author: iulius
Revision: 10050

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:
  trunk/include/portable/socket.h
  trunk/lib/inet_ntoa.c
  trunk/tests/lib/inet_ntoa-t.c
  trunk/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-08-05 11:40:25 UTC (rev 10049)
+++ include/portable/socket.h	2016-08-17 13:28:53 UTC (rev 10050)
@@ -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-08-05 11:40:25 UTC (rev 10049)
+++ lib/inet_ntoa.c	2016-08-17 13:28:53 UTC (rev 10050)
@@ -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-08-05 11:40:25 UTC (rev 10049)
+++ tests/lib/inet_ntoa-t.c	2016-08-17 13:28:53 UTC (rev 10050)
@@ -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-08-05 11:40:25 UTC (rev 10049)
+++ tests/lib/network/server-t.c	2016-08-17 13:28:53 UTC (rev 10050)
@@ -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