diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-02-16 10:31:24 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-02-16 10:31:24 +0000 |
commit | b8688f2ada91c748989ef5f9f52459ac8842b0f5 (patch) | |
tree | ed43ce2debfc15c5046d63cc54fe72cebf1d609e /usr.bin/netstat | |
parent | 636e73005fed3365c58e9f556d097bb7d8c0af33 (diff) |
deal with errors in recent change better
Diffstat (limited to 'usr.bin/netstat')
-rw-r--r-- | usr.bin/netstat/inet.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c index b59d4c1e3e9..c7037d22051 100644 --- a/usr.bin/netstat/inet.c +++ b/usr.bin/netstat/inet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: inet.c,v 1.6 1997/02/16 10:26:36 deraadt Exp $ */ +/* $OpenBSD: inet.c,v 1.7 1997/02/16 10:31:23 deraadt Exp $ */ /* $NetBSD: inet.c,v 1.14 1995/10/03 21:42:37 thorpej Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "from: @(#)inet.c 8.4 (Berkeley) 4/20/94"; #else -static char *rcsid = "$OpenBSD: inet.c,v 1.6 1997/02/16 10:26:36 deraadt Exp $"; +static char *rcsid = "$OpenBSD: inet.c,v 1.7 1997/02/16 10:31:23 deraadt Exp $"; #endif #endif /* not lint */ @@ -447,10 +447,10 @@ getrpcportnam(port) if (first == 0) { first = 1; - bzero((char *)&server_addr, sizeof server_addr); + memset((char *)&server_addr, 0, sizeof server_addr); server_addr.sin_family = AF_INET; if ((hp = gethostbyname("localhost")) != NULL) - bcopy(hp->h_addr, (caddr_t)&server_addr.sin_addr, + memmove((caddr_t)&server_addr.sin_addr, hp->h_addr, hp->h_length); else (void) inet_aton("0.0.0.0", &server_addr.sin_addr); @@ -459,15 +459,12 @@ getrpcportnam(port) minutetimeout.tv_usec = 0; server_addr.sin_port = htons(PMAPPORT); if ((client = clnttcp_create(&server_addr, PMAPPROG, - PMAPVERS, &socket, 50, 500)) == NULL) { - clnt_pcreateerror("rpcinfo: can't contact portmapper"); - exit(1); - } + PMAPVERS, &socket, 50, 500)) == NULL) + return (NULL); if (clnt_call(client, PMAPPROC_DUMP, xdr_void, NULL, - xdr_pmaplist, &head, minutetimeout) != RPC_SUCCESS) { - fprintf(stderr, "rpcinfo: can't contact portmapper: "); - clnt_perror(client, "rpcinfo"); - exit(1); + xdr_pmaplist, &head, minutetimeout) != RPC_SUCCESS) + clnt_destroy(client); + return (NULL); } for (; head != NULL; head = head->pml_next) { n = (struct rpcnams *)malloc(sizeof(struct rpcnams)); |