From: itojun Date: Sat, 30 Oct 1999 23:45:50 +0000 (+0000) Subject: HP-UX 10.20 build fix X-Git-Tag: tcpdump-3.5.1~529 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/70fbff8d347609250fae0846cff0f412bc9005bd HP-UX 10.20 build fix #ifdef h_errno, snprintf -> sprintf, arpa/inet.h for [hn]to[hn][sl] --- diff --git a/aclocal.m4 b/aclocal.m4 index ff49c848..297767fa 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,4 +1,4 @@ -dnl @(#) $Header: /tcpdump/master/tcpdump/aclocal.m4,v 1.66 1999-10-30 07:36:35 itojun Exp $ (LBL) +dnl @(#) $Header: /tcpdump/master/tcpdump/aclocal.m4,v 1.67 1999-10-30 23:45:50 itojun Exp $ (LBL) dnl dnl Copyright (c) 1995, 1996, 1997, 1998 dnl The Regents of the University of California. All rights reserved. @@ -975,3 +975,19 @@ AC_DEFUN(AC_STRUCT_RES_STATE, [ fi ]) +dnl +dnl check for h_errno +AC_DEFUN(AC_VAR_H_ERRNO, [ + AC_MSG_CHECKING(for h_errno) + AC_CACHE_VAL(ac_cv_var_h_errno, + AC_TRY_COMPILE([ +# include +# include ], + [int foo = h_errno;], + ac_cv_var_h_errno=yes, + ac_cv_var_h_errno=no)) + AC_MSG_RESULT($ac_cv_var_h_errno) + if test "$ac_cv_var_h_errno" = "yes"; then + AC_DEFINE(HAVE_H_ERRNO) + fi +]) diff --git a/configure.in b/configure.in index 6384545a..fb1523a6 100644 --- a/configure.in +++ b/configure.in @@ -1,4 +1,4 @@ -dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.79 1999-10-30 23:43:57 itojun Exp $ (LBL) +dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.80 1999-10-30 23:45:51 itojun Exp $ (LBL) dnl dnl Copyright (c) 1994, 1995, 1996, 1997 dnl The Regents of the University of California. All rights reserved. @@ -519,6 +519,8 @@ fi AC_LBL_UNALIGNED_ACCESS +AC_VAR_H_ERRNO + AC_MSG_CHECKING(for SSLeay) ac_cv_ssleay_path=no incdir=no diff --git a/missing/getaddrinfo.c b/missing/getaddrinfo.c index cdbd9e8a..778d8bf1 100644 --- a/missing/getaddrinfo.c +++ b/missing/getaddrinfo.c @@ -539,12 +539,20 @@ explore_fqdn(pai, hostname, servname, res) hp = getipnodebyname(hostname, pai->ai_family, AI_ADDRCONFIG, &h_error); #elif defined(HAVE_GETHOSTBYNAME2) hp = gethostbyname2(hostname, pai->ai_family); +#ifdef HAVE_H_ERRNO h_error = h_errno; +#else + h_error = EINVAL; +#endif #else if (pai->ai_family != AF_INET) return 0; hp = gethostbyname(hostname); +#ifdef HAVE_H_ERRNO h_error = h_errno; +#else + h_error = EINVAL; +#endif #endif if (hp == NULL) { diff --git a/missing/getnameinfo.c b/missing/getnameinfo.c index 19545e58..4b8d2dda 100644 --- a/missing/getnameinfo.c +++ b/missing/getnameinfo.c @@ -48,6 +48,7 @@ #include #include #include +#include #ifndef HAVE_PORTABLE_PROTOTYPE #include "cdecl_ext.h" @@ -149,7 +150,7 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags) return ENI_MEMORY; strcpy(serv, sp->s_name); } else { - snprintf(numserv, sizeof(numserv), "%d", ntohs(port)); + sprintf(numserv, "%d", ntohs(port)); if (strlen(numserv) > servlen) return ENI_MEMORY; strcpy(serv, numserv); @@ -228,7 +229,11 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags) hp = getipnodebyaddr(addr, afd->a_addrlen, afd->a_af, &h_error); #else hp = gethostbyaddr(addr, afd->a_addrlen, afd->a_af); +#ifdef HAVE_H_ERRNO h_error = h_errno; +#else + h_error = EINVAL; +#endif #endif if (hp) { diff --git a/missing/inet_ntop.c b/missing/inet_ntop.c index ce6ecaad..a6801b27 100644 --- a/missing/inet_ntop.c +++ b/missing/inet_ntop.c @@ -36,8 +36,9 @@ * SUCH DAMAGE. */ -/* $Id: inet_ntop.c,v 1.1 1999-10-30 07:53:39 itojun Exp $ */ +/* $Id: inet_ntop.c,v 1.2 1999-10-30 23:45:52 itojun Exp $ */ +#include #include #include #include diff --git a/print-bgp.c b/print-bgp.c index 895dc698..3525a12e 100644 --- a/print-bgp.c +++ b/print-bgp.c @@ -211,7 +211,7 @@ num_or_str(const char **table, size_t siz, int value) { static char buf[20]; if (value < 0 || siz <= value || table[value] == NULL) { - snprintf(buf, sizeof(buf), "#%d", value); + sprintf(buf, "#%d", value); return buf; } else return table[value]; @@ -237,7 +237,7 @@ bgp_notify_minor(int major, int minor) } else p = NULL; if (p == NULL) { - snprintf(buf, sizeof(buf), "#%d", minor); + sprintf(buf, "#%d", minor); return buf; } else return p; @@ -259,7 +259,7 @@ decode_prefix4(const u_char *pd, char *buf, int buflen) ((u_char *)&addr)[(plen + 7) / 8 - 1] &= ((0xff00 >> (plen % 8)) & 0xff); } - snprintf(buf, buflen, "%s/%d", getname((char *)&addr), plen); + sprintf(buf, "%s/%d", getname((char *)&addr), plen); return 1 + (plen + 7) / 8; } @@ -280,7 +280,7 @@ decode_prefix6(const u_char *pd, char *buf, int buflen) addr.s6_addr[(plen + 7) / 8 - 1] &= ((0xff00 >> (plen % 8)) & 0xff); } - snprintf(buf, buflen, "%s/%d", getname6((char *)&addr), plen); + sprintf(buf, "%s/%d", getname6((char *)&addr), plen); return 1 + (plen + 7) / 8; } #endif diff --git a/print-isakmp.c b/print-isakmp.c index 7acf8940..f0977cc0 100644 --- a/print-isakmp.c +++ b/print-isakmp.c @@ -30,7 +30,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-isakmp.c,v 1.6 1999-10-30 07:36:37 itojun Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-isakmp.c,v 1.7 1999-10-30 23:45:51 itojun Exp $ (LBL)"; #endif #include @@ -985,7 +985,7 @@ static char * numstr(int x) { static char buf[20]; - snprintf(buf, sizeof(buf), "#%d", x); + sprintf(buf, "#%d", x); return buf; } diff --git a/print-l2tp.c b/print-l2tp.c index 3d71fcf4..3b47b1aa 100644 --- a/print-l2tp.c +++ b/print-l2tp.c @@ -23,11 +23,13 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-l2tp.c,v 1.1 1999-10-30 05:11:18 itojun Exp $"; + "@(#) $Header: /tcpdump/master/tcpdump/print-l2tp.c,v 1.2 1999-10-30 23:45:51 itojun Exp $"; #endif #include #include +#include +#include #include "l2tp.h" #include "interface.h" diff --git a/print-ppp.c b/print-ppp.c index 89ab24dc..fe74518a 100644 --- a/print-ppp.c +++ b/print-ppp.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-ppp.c,v 1.27 1999-10-30 05:11:19 itojun Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-ppp.c,v 1.28 1999-10-30 23:45:51 itojun Exp $ (LBL)"; #endif #include @@ -217,7 +217,7 @@ ppp_protoname(int proto) case PPP_CHAP: return "CHAP"; #endif default: - snprintf(buf, sizeof(buf), "unknown-0x%04x\n", proto); + sprintf(buf, "unknown-0x%04x\n", proto); return buf; } }