mirror of
https://github.com/nmap/nmap.git
synced 2026-01-04 13:49:03 +00:00
Use socklen_t as the type in arguments to getsockname and getsockopt to
avoid a "pointer targets differ in signedness" warning. Add a check for socklen_t in configure.in; if it's not present, typedef it to int.
This commit is contained in:
@@ -31,6 +31,10 @@ o Added libdnet-stripped.vcproj -- A Visual Studio.Net project file
|
||||
o Regenerated build files with Autoconf 2.63, Automake 1.10.1, and
|
||||
libtool 2.2.6.
|
||||
|
||||
o Added a check for socklen_t in configure.in and used socklen_t when
|
||||
calling getsockname and getsockopt to avoid a "pointer targets differ
|
||||
in signedness" warning on platforms where socklen_t is unsigned.
|
||||
|
||||
o Made some code changes to intf.c (the patch below). This does the following:
|
||||
|
||||
o Preserve the alias qualifier from interface name in more cases
|
||||
|
||||
@@ -30,3 +30,7 @@ int strlcpy(char *, const char *, int);
|
||||
#ifndef HAVE_STRSEP
|
||||
char *strsep(char **, const char *);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_SOCKLEN_T
|
||||
typedef socklen_t int
|
||||
#endif
|
||||
|
||||
105
libdnet-stripped/configure
vendored
105
libdnet-stripped/configure
vendored
@@ -14021,6 +14021,111 @@ fi
|
||||
if test "$GCC" = yes ; then
|
||||
CFLAGS="$CFLAGS -Wall"
|
||||
fi
|
||||
{ $as_echo "$as_me:$LINENO: checking for socklen_t" >&5
|
||||
$as_echo_n "checking for socklen_t... " >&6; }
|
||||
if test "${ac_cv_type_socklen_t+set}" = set; then
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
ac_cv_type_socklen_t=no
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
#include <sys/socket.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
if (sizeof (socklen_t))
|
||||
return 0;
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (ac_try="$ac_compile"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo") >&5
|
||||
(eval "$ac_compile") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && {
|
||||
test -z "$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest.$ac_objext; then
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
#include <sys/socket.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
if (sizeof ((socklen_t)))
|
||||
return 0;
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (ac_try="$ac_compile"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo") >&5
|
||||
(eval "$ac_compile") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && {
|
||||
test -z "$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest.$ac_objext; then
|
||||
:
|
||||
else
|
||||
$as_echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_cv_type_socklen_t=yes
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
else
|
||||
$as_echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_socklen_t" >&5
|
||||
$as_echo "$ac_cv_type_socklen_t" >&6; }
|
||||
if test "x$ac_cv_type_socklen_t" = x""yes; then
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_SOCKLEN_T 1
|
||||
_ACEOF
|
||||
|
||||
|
||||
fi
|
||||
|
||||
|
||||
{ $as_echo "$as_me:$LINENO: checking for working memcmp" >&5
|
||||
$as_echo_n "checking for working memcmp... " >&6; }
|
||||
|
||||
@@ -194,6 +194,7 @@ AC_PROG_GCC_TRADITIONAL
|
||||
if test "$GCC" = yes ; then
|
||||
CFLAGS="$CFLAGS -Wall"
|
||||
fi
|
||||
AC_CHECK_TYPES([socklen_t], [], [], [#include <sys/socket.h>])
|
||||
|
||||
dnl Checks for library functions.
|
||||
AC_FUNC_MEMCMP
|
||||
|
||||
@@ -142,6 +142,9 @@
|
||||
/* Define if sockaddr struct has sa_len. */
|
||||
#undef HAVE_SOCKADDR_SA_LEN
|
||||
|
||||
/* Define to 1 if the system has the type `socklen_t'. */
|
||||
#undef HAVE_SOCKLEN_T
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
@@ -296,3 +299,7 @@ int strlcpy(char *, const char *, int);
|
||||
#ifndef HAVE_STRSEP
|
||||
char *strsep(char **, const char *);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_SOCKLEN_T
|
||||
typedef socklen_t int
|
||||
#endif
|
||||
|
||||
@@ -634,7 +634,7 @@ int
|
||||
intf_get_dst(intf_t *intf, struct intf_entry *entry, struct addr *dst)
|
||||
{
|
||||
struct sockaddr_in sin;
|
||||
int n;
|
||||
socklen_t n;
|
||||
|
||||
if (dst->addr_type != ADDR_TYPE_IP) {
|
||||
errno = EINVAL;
|
||||
|
||||
@@ -26,7 +26,8 @@ ip_t *
|
||||
ip_open(void)
|
||||
{
|
||||
ip_t *i;
|
||||
int n, len;
|
||||
int n;
|
||||
socklen_t len;
|
||||
|
||||
if ((i = calloc(1, sizeof(*i))) == NULL)
|
||||
return (NULL);
|
||||
|
||||
Reference in New Issue
Block a user