diff options
author | Guy Harris <guy@alum.mit.edu> | 2011-09-02 21:31:09 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2011-09-02 21:31:09 -0700 |
commit | 9daf43672179c72310d4b14d72143ba5f999557f (patch) | |
tree | 4b6e93437217e0b120e46f657cbdd0ad94efe1db /print-sunrpc.c | |
parent | 894e8113f083ee052de5cf559b204e5609134bfa (diff) | |
download | tcpdump-9daf43672179c72310d4b14d72143ba5f999557f.tar.gz |
Handle systems with getrpcbynumber() but no header file for it.
Glibc 2.14 doesn't install the ONC RPC headers, but it installs the ONC
RPC routines, presumably for binary compatibility. Don't use
getrpcbynumber() unless we have it *and* the header file to declare it.
Diffstat (limited to 'print-sunrpc.c')
-rw-r--r-- | print-sunrpc.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/print-sunrpc.c b/print-sunrpc.c index e33b7625..21cd85a9 100644 --- a/print-sunrpc.c +++ b/print-sunrpc.c @@ -45,12 +45,12 @@ static const char rcsid[] _U_ = #include <tcpdump-stdinc.h> -#ifdef HAVE_GETRPCBYNUMBER +#if defined(HAVE_GETRPCBYNUMBER) && defined(HAVE_RPC_RPC_H) #include <rpc/rpc.h> #ifdef HAVE_RPC_RPCENT_H #include <rpc/rpcent.h> #endif /* HAVE_RPC_RPCENT_H */ -#endif /* HAVE_GETRPCBYNUMBER */ +#endif /* defined(HAVE_GETRPCBYNUMBER) && defined(HAVE_RPC_RPC_H) */ #include <stdio.h> #include <string.h> @@ -151,7 +151,7 @@ static char * progstr(prog) u_int32_t prog; { -#ifdef HAVE_GETRPCBYNUMBER +#if defined(HAVE_GETRPCBYNUMBER) && defined(HAVE_RPC_RPC_H) register struct rpcent *rp; #endif static char buf[32]; @@ -159,12 +159,12 @@ progstr(prog) if (lastprog != 0 && prog == lastprog) return (buf); -#ifdef HAVE_GETRPCBYNUMBER +#if defined(HAVE_GETRPCBYNUMBER) && defined(HAVE_RPC_RPC_H) rp = getrpcbynumber(prog); if (rp == NULL) #endif (void) snprintf(buf, sizeof(buf), "#%u", prog); -#ifdef HAVE_GETRPCBYNUMBER +#if defined(HAVE_GETRPCBYNUMBER) && defined(HAVE_RPC_RPC_H) else strlcpy(buf, rp->r_name, sizeof(buf)); #endif |