From: Dave Hart Date: Sun, 3 Jun 2012 07:18:47 +0000 (+0000) Subject: Update --enable-getifaddrs handling in ntp_ipv6.m4 to match bind 9.9.1 for X-Git-Tag: NTP_4_2_7P278~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c1749686432d190711f31a8083d2a7d8a86b6de0;p=thirdparty%2Fntp.git Update --enable-getifaddrs handling in ntp_ipv6.m4 to match bind 9.9.1 for [Bug 2204] Build with --enable-getifaddrs=glibc fails bk: 4fcb0fd7U8VCqsWkQb_3O8X7R96r2w --- diff --git a/include/isc/mem.h b/include/isc/mem.h index f5cf9ec57..ba1bfeb0e 100644 --- a/include/isc/mem.h +++ b/include/isc/mem.h @@ -60,9 +60,9 @@ #define isc_mem_strdup(c, str) \ ( ISC_MEM_UNUSED_ARG(c), estrdup(str) ) -#define isc_mem_attach(src, ptgt) do { *(ptgt) = (src); } while (0) -#define isc_mem_detach(c) ISC_MEM_UNUSED_ARG(c) -#define isc_mem_printallactive(s) fprintf((s), \ +#define isc__mem_attach(src, ptgt) do { *(ptgt) = (src); } while (0) +#define isc__mem_detach(c) ISC_MEM_UNUSED_ARG(c) +#define isc__mem_printallactive(s) fprintf((s), \ "isc_mem_printallactive() stubbed.\n") #endif /* ISC_MEM_H */ diff --git a/include/ntp_stdlib.h b/include/ntp_stdlib.h index 9c4215cb3..140247285 100644 --- a/include/ntp_stdlib.h +++ b/include/ntp_stdlib.h @@ -18,25 +18,6 @@ #include "ntp_syslog.h" -/* - * #define away gcc __attribute__ if unavailable. - */ -#ifndef __attribute__ - /* This feature is available in gcc versions 2.5 and later. */ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || (defined(__STRICT_ANSI__)) -# define __attribute__(Spec) /* empty */ -# endif - /* - * The __-protected variants of `format' and `printf' attributes are - * accepted by gcc versions 2.6.4 (effectively 2.7) and later. - */ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) -# define __format__ format -# define __printf__ printf -# define __noreturn__ noreturn -# endif -#endif - extern int mprintf(const char *, ...) __attribute__((__format__(__printf__, 1, 2))); extern int mfprintf(FILE *, const char *, ...) diff --git a/lib/isc/assertions.c b/lib/isc/assertions.c index bde4e88dc..31c4fe7c9 100644 --- a/lib/isc/assertions.c +++ b/lib/isc/assertions.c @@ -40,8 +40,7 @@ * Forward. */ static void -default_callback(const char *, int, isc_assertiontype_t, const char *) - __attribute__ ((__noreturn__)); +default_callback(const char *, int, isc_assertiontype_t, const char *); static isc_assertioncallback_t isc_assertion_failed_cb = default_callback; diff --git a/lib/isc/include/isc/assertions.h b/lib/isc/include/isc/assertions.h index c30282ac0..2c81b1ae9 100644 --- a/lib/isc/include/isc/assertions.h +++ b/lib/isc/include/isc/assertions.h @@ -27,25 +27,6 @@ #include #include -/* - * #define away gcc __attribute__ if unavailable. - */ -#ifndef __attribute__ - /* This feature is available in gcc versions 2.5 and later. */ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || (defined(__STRICT_ANSI__)) -# define __attribute__(Spec) /* empty */ -# endif - /* - * The __-protected variants of `format' and `printf' attributes are - * accepted by gcc versions 2.6.4 (effectively 2.7) and later. - */ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) -# define __format__ format -# define __printf__ printf -# define __noreturn__ noreturn -# endif -#endif - ISC_LANG_BEGINDECLS /*% isc assertion type */ @@ -57,8 +38,7 @@ typedef enum { } isc_assertiontype_t; typedef void (*isc_assertioncallback_t)(const char *, int, isc_assertiontype_t, - const char *) - __attribute__ ((__noreturn__)); + const char *); /* coverity[+kill] */ ISC_PLATFORM_NORETURN_PRE diff --git a/lib/isc/task.c b/lib/isc/task.c index 6c572f1ee..cd19d2d52 100644 --- a/lib/isc/task.c +++ b/lib/isc/task.c @@ -1359,8 +1359,6 @@ isc__taskmgr_create(isc_mem_t *mctx, unsigned int workers, if (result != ISC_R_SUCCESS) goto cleanup_mgr; LOCK(&manager->lock); - manager->magic = TASK_MANAGER_MAGIC; - manager->mctx = NULL; #ifdef USE_WORKER_THREADS manager->workers = 0; diff --git a/lib/isc/unix/interfaceiter.c b/lib/isc/unix/interfaceiter.c index d50b61b22..c42fa685c 100644 --- a/lib/isc/unix/interfaceiter.c +++ b/lib/isc/unix/interfaceiter.c @@ -189,11 +189,9 @@ static isc_result_t linux_if_inet6_current(isc_interfaceiter_t *iter) { char address[33]; char name[IF_NAMESIZE+1]; - char strbuf[ISC_STRERRORSIZE]; struct in6_addr addr6; unsigned int ifindex; int prefix, scope, flags; - struct ifreq ifreq; int res; unsigned int i; @@ -238,34 +236,7 @@ linux_if_inet6_current(isc_interfaceiter_t *iter) { addr6.s6_addr[i] = byte; } iter->current.af = AF_INET6; - iter->current.flags = 0; - memset(&ifreq, 0, sizeof(ifreq)); - INSIST(sizeof(ifreq.ifr_name) <= sizeof(iter->current.name)); - strncpy(ifreq.ifr_name, name, sizeof(ifreq.ifr_name)); - - if (ioctl(iter->socket, SIOCGIFFLAGS, (char *) &ifreq) < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - "%s: getting interface flags: %s", - ifreq.ifr_name, strbuf); - return (ISC_R_IGNORE); - } - - if ((ifreq.ifr_flags & IFF_UP) != 0) - iter->current.flags |= INTERFACE_F_UP; -#ifdef IFF_POINTOPOINT - if ((ifreq.ifr_flags & IFF_POINTOPOINT) != 0) - iter->current.flags |= INTERFACE_F_POINTTOPOINT; -#endif - if ((ifreq.ifr_flags & IFF_LOOPBACK) != 0) - iter->current.flags |= INTERFACE_F_LOOPBACK; - if ((ifreq.ifr_flags & IFF_BROADCAST) != 0) - iter->current.flags |= INTERFACE_F_BROADCAST; -#ifdef IFF_MULTICAST - if ((ifreq.ifr_flags & IFF_MULTICAST) != 0) - iter->current.flags |= INTERFACE_F_MULTICAST; -#endif - + iter->current.flags = INTERFACE_F_UP; isc_netaddr_fromin6(&iter->current.address, &addr6); iter->current.ifindex = ifindex; if (isc_netaddr_islinklocal(&iter->current.address)) { diff --git a/libntp/Makefile.am b/libntp/Makefile.am index e86a7259a..d0aa08d7c 100644 --- a/libntp/Makefile.am +++ b/libntp/Makefile.am @@ -7,6 +7,8 @@ EXTRA_LIBRARIES = libntpsim.a libisc_SRCS = \ $(srcdir)/../lib/isc/assertions.c \ $(srcdir)/../lib/isc/buffer.c \ + $(srcdir)/../lib/isc/backtrace-emptytbl.c \ + $(srcdir)/../lib/isc/backtrace.c \ $(srcdir)/../lib/isc/$(LIBISC_PTHREADS_NOTHREADS)/condition.c \ $(srcdir)/../lib/isc/unix/dir.c \ $(srcdir)/../lib/isc/error.c \ diff --git a/libntp/msyslog.c b/libntp/msyslog.c index 8ed9dc4e7..283414d74 100644 --- a/libntp/msyslog.c +++ b/libntp/msyslog.c @@ -45,14 +45,6 @@ void addto_syslog (int, const char *); #ifndef VSNPRINTF_PERCENT_M void format_errmsg (char *, size_t, const char *, int); -/* - * Work around misdetection by AC_FUNC_STRERROR_R on Debian Linux. - */ -# if defined(STRERROR_R_CHAR_P) && strerror_r == __xpg_strerror_r -# undef STRERROR_R_CHAR_P -# endif - - /* format_errmsg() is under #ifndef VSNPRINTF_PERCENT_M above */ void format_errmsg( @@ -115,15 +107,7 @@ errno_to_str( buf[0] = '\0'; # ifdef STRERROR_R_CHAR_P - /* - * For older GNU strerror_r, the return value either points to - * buf, or to static storage. We want the result always in buf. - * On Debian Linux 6.03 with gcc 4.4, strerror_r() returns an - * int despite configure detecting STRERROR_R_CHAR_P. We are - * careful with the result, but need to cast to (char *) to - * silence gcc on Debian 6.03. - */ - pstatic = (char *)strerror_r(err, buf, bufsiz); + pstatic = strerror_r(err, buf, bufsiz); # else pstatic = strerror(err); # endif diff --git a/ports/winnt/include/config.h b/ports/winnt/include/config.h index e1a84c034..83b36d042 100644 --- a/ports/winnt/include/config.h +++ b/ports/winnt/include/config.h @@ -32,8 +32,9 @@ #define _WIN32_WINNT 0x0501 #endif - +#define __attribute__(x) /* empty */ #define _CRT_SECURE_NO_DEPRECATE 1 + /* * ANSI C compliance enabled */ diff --git a/ports/winnt/vs2005/libntp.vcproj b/ports/winnt/vs2005/libntp.vcproj index 26d51d2f8..f2d0b9e71 100644 --- a/ports/winnt/vs2005/libntp.vcproj +++ b/ports/winnt/vs2005/libntp.vcproj @@ -212,6 +212,14 @@ RelativePath="..\..\..\lib\isc\buffer.c" > + + + + diff --git a/ports/winnt/vs2008/libntp/libntp.vcproj b/ports/winnt/vs2008/libntp/libntp.vcproj index 37e301bed..4c1a0dc75 100644 --- a/ports/winnt/vs2008/libntp/libntp.vcproj +++ b/ports/winnt/vs2008/libntp/libntp.vcproj @@ -223,6 +223,14 @@ RelativePath="..\..\..\..\libntp\authusekey.c" > + + + + @@ -853,11 +861,11 @@ > /* before #define vsnprintf rpl_... */ - #endif + AH_VERBATIM( + [snprinte],dnl sorted in config.h just before #define snprintf + [ + #if !defined(_KERNEL) && !defined(PARSESTREAM) + /* + * stdio.h must be included after _GNU_SOURCE is defined + * but before #define snprintf rpl_snprintf + */ + # include + #endif ]) AH_BOTTOM([ #if !defined(_KERNEL) && !defined(PARSESTREAM)