Trying to build postfix with:
$ make 'CCARGS= -DNO_IPV6 -DHAS_CDB -I/usr/include/cdb' 'AUXLIBS=-Wl,-O1
-Wl,--as-needed -lcdb' makefiles && make

results in:
[...]
gcc -Wmissing-prototypes -Wformat -DNO_IPV6 -DHAS_CDB -I/usr/include/cdb
-DHAS_PCRE -DSNAPSHOT -g -O -I. -DLINUX3 -c cidr_match.c
In file included from cidr_match.c:53:0:
/usr/include/arpa/inet.h:65:22: error: conflicting types for ‘inet_ntop’
./sys_defs.h:1345:20: note: previous declaration of ‘inet_ntop’ was here
make: *** [cidr_match.o] Error 1
make: *** [update] Error 1

man 3  inet_ntop says:
[...]
CONFORMING TO
       POSIX.1-2001.   Note that RFC 2553 defines a prototype where the
       last argument size is of type size_t.  Many systems follow RFC
       2553.
       Glibc 2.0 and 2.1 have size_t, but 2.2 and later have socklen_t.

The patch below works for me with glibc-2.14.  Glibc-2.2 was released in
2000 but I do not know if you want to drop support for <glibc-2.2.

--- a/src/util/sys_compat.c
+++ b/src/util/sys_compat.c
@@ -293,7 +293,7 @@ int     closefrom(int lowfd)
 
 /* inet_ntop - convert binary address to printable address */
 
-const char *inet_ntop(int af, const void *src, char *dst, size_t size)
+const char *inet_ntop(int af, const void *src, char *dst, socklen_t size)
 {
     const unsigned char *addr;
     char    buffer[sizeof("255.255.255.255")];
--- a/src/util/sys_defs.h
+++ b/src/util/sys_defs.h
@@ -748,7 +748,7 @@ extern int initgroups(const char *, int);
 #include <sys/types.h>
 #define UINT32_TYPE    unsigned int
 #define UINT16_TYPE    unsigned short
-#include <features.h>
+#include <sys/socket.h>
 #define USE_PATHS_H
 #define HAS_FLOCK_LOCK
 #define HAS_FCNTL_LOCK
@@ -1342,7 +1342,7 @@ extern int dup2_pass_on_exec(int oldd, int newd);
 #define EMULATE_IPV4_ADDRINFO
 #define MISSING_INET_PTON
 #define MISSING_INET_NTOP
-extern const char *inet_ntop(int, const void *, char *, size_t);
+extern const char *inet_ntop(int, const void *, char *, socklen_t);
 extern int inet_pton(int, const char *, void *);
 
 #endif

-- 
Eray Aslan

Reply via email to