Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/rpcinfo Cleanup use of 'host' when running 'rpcinfo ...



details:   https://anonhg.NetBSD.org/src/rev/9fe1f28bc3f0
branches:  trunk
changeset: 581484:9fe1f28bc3f0
user:      lukem <lukem%NetBSD.org@localhost>
date:      Thu Jun 02 02:46:16 2005 +0000

description:
Cleanup use of 'host' when running 'rpcinfo -p'.
Appease other -Wuninitialized warnings.

diffstat:

 usr.bin/rpcinfo/rpcinfo.c |  21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)

diffs (56 lines):

diff -r dd3417deb6df -r 9fe1f28bc3f0 usr.bin/rpcinfo/rpcinfo.c
--- a/usr.bin/rpcinfo/rpcinfo.c Thu Jun 02 02:19:51 2005 +0000
+++ b/usr.bin/rpcinfo/rpcinfo.c Thu Jun 02 02:46:16 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rpcinfo.c,v 1.21 2004/11/01 21:42:41 dsl Exp $ */
+/*     $NetBSD: rpcinfo.c,v 1.22 2005/06/02 02:46:16 lukem Exp $       */
 
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -494,7 +494,7 @@
        struct rpcent *rpc;
        enum clnt_stat clnt_st;
        struct rpc_err err;
-       char *host;
+       char *host = NULL;
 
        if (argc > 1) {
                usage();
@@ -533,10 +533,15 @@
                if ((clnt_st == RPC_PROGVERSMISMATCH) ||
                    (clnt_st == RPC_PROGUNAVAIL)) {
                        CLNT_GETERR(client, &err);
-                       if (err.re_vers.low > PMAPVERS)
-                               fprintf(stderr,
-               "%s does not support portmapper.  Try rpcinfo %s instead\n",
-                                       host, host);
+                       if (err.re_vers.low > PMAPVERS) {
+                               if (host)
+                                       fprintf(stderr,
+       "%s does not support portmapper.  Try 'rpcinfo %s' instead\n",
+                                           host, host);
+                               else
+                                       fprintf(stderr,
+       "local host does not support portmapper.  Try 'rpcinfo' instead\n");
+                       }
                        exit(1);
                }
                clnt_perror(client, "rpcinfo: can't contact portmapper");
@@ -716,7 +721,7 @@
        char *host;
        struct netidlist *nl;
        struct verslist *vl;
-       struct rpcbdump_short *rs, *rs_tail;
+       struct rpcbdump_short *rs, *rs_tail = NULL;
        char buf[256];
        enum clnt_stat clnt_st;
        struct rpc_err err;
@@ -773,7 +778,7 @@
                    if (err.re_vers.high == PMAPVERS) {
                        int high, low;
                        struct pmaplist *pmaphead = NULL;
-                       rpcblist_ptr list, prev;
+                       rpcblist_ptr list, prev = NULL;
 
                        vers = PMAPVERS;
                        clnt_control(client, CLSET_VERS, (char *)&vers);



Home | Main Index | Thread Index | Old Index