]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
configure check for cast to please lint.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Tue, 3 Apr 2007 09:17:20 +0000 (09:17 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Tue, 3 Apr 2007 09:17:20 +0000 (09:17 +0000)
git-svn-id: file:///svn/unbound/trunk@213 be551aaa-1e26-0410-a405-d3ace91eadb9

configure.ac
doc/Changelog
testcode/testbed.sh
util/netevent.c

index 95851e640344d3adea255b799b1da28abeda894e..a2ee74fc42bfa3840b6242fe89d11281f71eaf8f 100644 (file)
@@ -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 <stdlib.h>
+#include <stdio.h>
+#include <sys/socket.h>
+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
index 513a80ecf21233b567f3120bb45ab1a583148970..72d9bfa59a9058aa5082e7a7ca65e0a7636f2cce 100644 (file)
@@ -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.
index f338964435897dff11142e30d245a357b59219a8..9c52d1420c2812368b1cad6781a9adb469ed1dee 100755 (executable)
@@ -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]}
index 87e7fa3b43635280c69b439bcbbfcf4886921d83..ad5f690a42d13c3520e08ca30da1fbf2d4c5bd00 100644 (file)
@@ -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;