From 2ba7a95271fe5fa9c43b24c4cc94b764e7575a8b Mon Sep 17 00:00:00 2001 From: Mark Murray Date: Wed, 5 May 1999 06:15:30 +0000 Subject: [PATCH] Restore perror --> err changes. --- sbin/routed/rtquery/rtquery.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/sbin/routed/rtquery/rtquery.c b/sbin/routed/rtquery/rtquery.c index 25d9e8231469..2bcd76e33a14 100644 --- a/sbin/routed/rtquery/rtquery.c +++ b/sbin/routed/rtquery/rtquery.c @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: rtquery.c,v 1.10 1999/05/02 13:14:16 markm Exp $ */ char copyright[] = @@ -46,6 +46,7 @@ char copyright[] = #define RIPVERSION RIPv2 #include #include +#include #include #include #include @@ -62,7 +63,7 @@ static char sccsid[] __attribute__((unused))= "@(#)query.c 8.1 (Berkeley) 6/5/93 #elif defined(__NetBSD__) __RCSID("$NetBSD: rtquery.c,v 1.10 1999/02/23 10:47:41 christos Exp $"); #endif -#ident "$Revision: 2.17 $" +#ident "$Revision: 1.10 $" #ifndef sgi #define _HAVE_SIN_LEN @@ -274,8 +275,7 @@ main(int argc, soc = socket(AF_INET, SOCK_DGRAM, 0); if (soc < 0) { - perror("socket"); - exit(2); + err(2, "socket"); } /* be prepared to receive a lot of routes */ @@ -284,7 +284,7 @@ main(int argc, &bsize, sizeof(bsize)) == 0) break; if (bsize <= 4*1024) { - perror("setsockopt SO_RCVBUF"); + warn("setsockopt SO_RCVBUF"); break; } } @@ -338,8 +338,7 @@ trace_loop(char *argv[]) while (bind(soc, (struct sockaddr *)&myaddr, sizeof(myaddr)) < 0) { if (errno != EADDRINUSE || myaddr.sin_port == 0) { - perror("bind"); - exit(2); + err(2, "bind"); } myaddr.sin_port = htons(ntohs(myaddr.sin_port)-1); } @@ -428,8 +427,7 @@ query_loop(char *argv[], int argc) sizeof(imsg_buf.packet), 0, (struct sockaddr *)&from, &fromlen); if (cc < 0) { - perror("recvfrom"); - exit(1); + err(1, "recvfrom"); } /* count the distinct responding hosts. * You cannot match responding hosts with @@ -461,8 +459,7 @@ query_loop(char *argv[], int argc) if (cc < 0) { if (errno == EINTR) continue; - perror("select"); - exit(1); + err(1, "select"); } /* After a pause in responses, probe another host. @@ -480,8 +477,7 @@ query_loop(char *argv[], int argc) /* or until we have waited a long time */ if (gettimeofday(&now, 0) < 0) { - perror("gettimeofday(now)"); - exit(1); + err(1, "gettimeofday(now)"); } if (sent.tv_sec + wtime <= now.tv_sec) break; @@ -501,8 +497,7 @@ out(const char *host) struct hostent *hp; if (gettimeofday(&sent, 0) < 0) { - perror("gettimeofday(sent)"); - return -1; + err(-1, "gettimeofday(sent)"); } memset(&router, 0, sizeof(router)); @@ -522,8 +517,7 @@ out(const char *host) if (sendto(soc, &omsg_buf, omsg_len, 0, (struct sockaddr *)&router, sizeof(router)) < 0) { - perror(host); - return -1; + err(-1, host); } return 0;