Restore perror --> err changes.

This commit is contained in:
Mark Murray 1999-05-05 06:15:30 +00:00
parent 5a498f21b6
commit 2ba7a95271
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=46489

View File

@ -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 <protocols/routed.h>
#include <arpa/inet.h>
#include <err.h>
#include <netdb.h>
#include <errno.h>
#include <unistd.h>
@ -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;