From: Wouter Wijngaards Date: Tue, 3 Apr 2007 09:17:20 +0000 (+0000) Subject: configure check for cast to please lint. X-Git-Tag: release-0.2~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b777a38e0de2ddbb41bdce9ead11ed56ea54b887;p=thirdparty%2Funbound.git configure check for cast to please lint. git-svn-id: file:///svn/unbound/trunk@213 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/configure.ac b/configure.ac index 95851e640..a2ee74fc4 100644 --- a/configure.ac +++ b/configure.ac @@ -313,6 +313,29 @@ AC_INCLUDES_DEFAULT #endif ]) +# Check the type of struct msghdr msg_iovlen. +AC_MSG_CHECKING([sign of struct msghdr.msg_iovlen]) +AC_RUN_IFELSE([ +#include +#include +#include +int main() +{ + struct msghdr h; + h.msg_iovlen = -1; + if(10/h.msg_iovlen == 0) return 0; /* unsigned */ + return 1; /* signed */ +} +], [ +# if compiled and exit status 0 +cv_msgiovlen_type="unsigned" ], [ +# not compiled or bad exit status +cv_msgiovlen_type="int" ], +# when cross compiling +[ cv_msgiovlen_type="int" ]) +AC_MSG_RESULT($cv_msgiovlen_type) +AC_DEFINE_UNQUOTED([TYPE_MSGIOVLEN], $cv_msgiovlen_type, [Define to 'int' or type of struct msghdr.msg_iovlen.]) + # Checks for libraries. AC_ARG_WITH(ssl, AC_HELP_STRING([--with-ssl=pathname], [enable SSL (will check /usr/local/ssl diff --git a/doc/Changelog b/doc/Changelog index 513a80ecf..72d9bfa59 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,9 @@ +3 April 2007: Wouter + - detect sign of msghdr.msg_iovlen so that the cast to that type + in netevent (which is there to please lint) can be correct. + The type on several OSes ranges from int, int32, uint32, size_t. + Detects unsigned or signed using math trick. + 2 April 2007: Wouter - check sizes of udp received messages, not too short. - review changes. Some memmoves can be memcpys: 4byte aligned. diff --git a/testcode/testbed.sh b/testcode/testbed.sh index f33896443..9c52d1420 100755 --- a/testcode/testbed.sh +++ b/testcode/testbed.sh @@ -123,7 +123,7 @@ for((i=0; i<${#hostname[*]}; i=$i+1)); do SVN=yes IP6=yes FIXCONFIGURE=no - RUN_TEST=yes + RUN_TEST=no LDNS= LIBEVENT= eval ${vars[$i]} diff --git a/util/netevent.c b/util/netevent.c index 87e7fa3b4..ad5f690a4 100644 --- a/util/netevent.c +++ b/util/netevent.c @@ -790,7 +790,7 @@ comm_point_send_reply_iov(struct comm_reply* repinfo, struct iovec* iov, hdr.msg_name = &repinfo->addr; hdr.msg_namelen = repinfo->addrlen; hdr.msg_iov = iov + 1; - hdr.msg_iovlen = (typeof(hdr.msg_iovlen))(iovlen - 1); + hdr.msg_iovlen = (TYPE_MSGIOVLEN)(iovlen - 1); hdr.msg_control = NULL; hdr.msg_controllen = 0; hdr.msg_flags = 0;