Cleanup use of 'host' when running 'rpcinfo -p'.

Obtained from:	NetBSD
This commit is contained in:
Kevin Lo 2012-08-18 16:14:50 +00:00
parent 5bb295c408
commit b918e60351

View File

@ -476,7 +476,7 @@ pmapdump(int argc, char **argv)
struct rpcent *rpc; struct rpcent *rpc;
enum clnt_stat clnt_st; enum clnt_stat clnt_st;
struct rpc_err err; struct rpc_err err;
char *host; char *host = NULL;
if (argc > 1) if (argc > 1)
usage(); usage();
@ -513,10 +513,16 @@ pmapdump(int argc, char **argv)
if ((clnt_st == RPC_PROGVERSMISMATCH) || if ((clnt_st == RPC_PROGVERSMISMATCH) ||
(clnt_st == RPC_PROGUNAVAIL)) { (clnt_st == RPC_PROGUNAVAIL)) {
CLNT_GETERR(client, &err); CLNT_GETERR(client, &err);
if (err.re_vers.low > PMAPVERS) if (err.re_vers.low > PMAPVERS) {
warnx( if (host)
"%s does not support portmapper. Try rpcinfo %s instead", warnx("%s does not support portmapper."
host, host); "Try rpcinfo %s instead", host,
host);
else
warnx("local host does not support "
"portmapper. Try 'rpcinfo' "
"instead");
}
exit(1); exit(1);
} }
clnt_perror(client, "rpcinfo: can't contact portmapper"); clnt_perror(client, "rpcinfo: can't contact portmapper");