]> The Tcpdump Group git mirrors - tcpdump/commitdiff
HP-UX 10.20 build fix <http://www.sics.se/~assar/tcpdump_patches/13>
authoritojun <itojun>
Sat, 30 Oct 1999 23:45:50 +0000 (23:45 +0000)
committeritojun <itojun>
Sat, 30 Oct 1999 23:45:50 +0000 (23:45 +0000)
#ifdef h_errno, snprintf -> sprintf, arpa/inet.h for [hn]to[hn][sl]

aclocal.m4
configure.in
missing/getaddrinfo.c
missing/getnameinfo.c
missing/inet_ntop.c
print-bgp.c
print-isakmp.c
print-l2tp.c
print-ppp.c

index ff49c84822b6ceba5b848d4fb55780dde42d44ca..297767fae346715511230799af4ccbcb1e0e9f60 100644 (file)
@@ -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 <sys/types.h>
+#              include <netdb.h>],
+               [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
+])
index 6384545a994bf1f1caee071b60bce97a9dbc9e36..fb1523a6699b82ec4b737eecf716f3e48d0aca6c 100644 (file)
@@ -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
index cdbd9e8aa2d1ed78559a280b080aa7aaf47da22b..778d8bf166c123b3309f9e618a4b1de5da2b3dd8 100644 (file)
@@ -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) {
index 19545e58db2fc2147681ae531e99c04a4321ec05..4b8d2dda68c4333e9f11d64f2f3e3c4f77989208 100644 (file)
@@ -48,6 +48,7 @@
 #include <resolv.h>
 #include <string.h>
 #include <stddef.h>
+#include <errno.h>
 
 #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) {
index ce6ecaada2495ad3d72d287e0c2609e551b84a61..a6801b273b687ea5741662a5ac2dcc33510aeebc 100644 (file)
@@ -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 <stdio.h>
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/socket.h>
index 895dc698a175663c2a029e6904b2f530e8d8fb1d..3525a12e175ec05a7e1f6e04f1be480d014afa40 100644 (file)
@@ -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
index 7acf89402075002078d319aadf8e6ad675d667b1..f0977cc0fbd0e9ba3a2cd0a6ee9929dedcfbc5b8 100644 (file)
@@ -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 <string.h>
@@ -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;
 }
 
index 3d71fcf4a622bfc9dae9572c1f54d4dd4a96ccd3..3b47b1aabee3552bcc8edce097d56cec2c23ebc7 100644 (file)
 
 #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 <sys/types.h>
 #include <sys/param.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
 
 #include "l2tp.h"
 #include "interface.h"
index 89ab24dca0899d15fe4ee12143abb5b40ede0b18..fe74518a516eb8793e81032f07c7fd5cdc61dde4 100644 (file)
@@ -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 <sys/param.h>
@@ -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;
        }
 }