Restore perror --> err changes.
This commit is contained in:
parent
5a498f21b6
commit
2ba7a95271
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=46489
@ -30,7 +30,7 @@
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id: rtquery.c,v 1.10 1999/05/02 13:14:16 markm Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char copyright[] =
|
char copyright[] =
|
||||||
@ -46,6 +46,7 @@ char copyright[] =
|
|||||||
#define RIPVERSION RIPv2
|
#define RIPVERSION RIPv2
|
||||||
#include <protocols/routed.h>
|
#include <protocols/routed.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
#include <err.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -62,7 +63,7 @@ static char sccsid[] __attribute__((unused))= "@(#)query.c 8.1 (Berkeley) 6/5/93
|
|||||||
#elif defined(__NetBSD__)
|
#elif defined(__NetBSD__)
|
||||||
__RCSID("$NetBSD: rtquery.c,v 1.10 1999/02/23 10:47:41 christos Exp $");
|
__RCSID("$NetBSD: rtquery.c,v 1.10 1999/02/23 10:47:41 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
#ident "$Revision: 2.17 $"
|
#ident "$Revision: 1.10 $"
|
||||||
|
|
||||||
#ifndef sgi
|
#ifndef sgi
|
||||||
#define _HAVE_SIN_LEN
|
#define _HAVE_SIN_LEN
|
||||||
@ -274,8 +275,7 @@ main(int argc,
|
|||||||
|
|
||||||
soc = socket(AF_INET, SOCK_DGRAM, 0);
|
soc = socket(AF_INET, SOCK_DGRAM, 0);
|
||||||
if (soc < 0) {
|
if (soc < 0) {
|
||||||
perror("socket");
|
err(2, "socket");
|
||||||
exit(2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* be prepared to receive a lot of routes */
|
/* be prepared to receive a lot of routes */
|
||||||
@ -284,7 +284,7 @@ main(int argc,
|
|||||||
&bsize, sizeof(bsize)) == 0)
|
&bsize, sizeof(bsize)) == 0)
|
||||||
break;
|
break;
|
||||||
if (bsize <= 4*1024) {
|
if (bsize <= 4*1024) {
|
||||||
perror("setsockopt SO_RCVBUF");
|
warn("setsockopt SO_RCVBUF");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -338,8 +338,7 @@ trace_loop(char *argv[])
|
|||||||
while (bind(soc, (struct sockaddr *)&myaddr, sizeof(myaddr)) < 0) {
|
while (bind(soc, (struct sockaddr *)&myaddr, sizeof(myaddr)) < 0) {
|
||||||
if (errno != EADDRINUSE
|
if (errno != EADDRINUSE
|
||||||
|| myaddr.sin_port == 0) {
|
|| myaddr.sin_port == 0) {
|
||||||
perror("bind");
|
err(2, "bind");
|
||||||
exit(2);
|
|
||||||
}
|
}
|
||||||
myaddr.sin_port = htons(ntohs(myaddr.sin_port)-1);
|
myaddr.sin_port = htons(ntohs(myaddr.sin_port)-1);
|
||||||
}
|
}
|
||||||
@ -428,8 +427,7 @@ query_loop(char *argv[], int argc)
|
|||||||
sizeof(imsg_buf.packet), 0,
|
sizeof(imsg_buf.packet), 0,
|
||||||
(struct sockaddr *)&from, &fromlen);
|
(struct sockaddr *)&from, &fromlen);
|
||||||
if (cc < 0) {
|
if (cc < 0) {
|
||||||
perror("recvfrom");
|
err(1, "recvfrom");
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
/* count the distinct responding hosts.
|
/* count the distinct responding hosts.
|
||||||
* You cannot match responding hosts with
|
* You cannot match responding hosts with
|
||||||
@ -461,8 +459,7 @@ query_loop(char *argv[], int argc)
|
|||||||
if (cc < 0) {
|
if (cc < 0) {
|
||||||
if (errno == EINTR)
|
if (errno == EINTR)
|
||||||
continue;
|
continue;
|
||||||
perror("select");
|
err(1, "select");
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* After a pause in responses, probe another host.
|
/* 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
|
/* or until we have waited a long time
|
||||||
*/
|
*/
|
||||||
if (gettimeofday(&now, 0) < 0) {
|
if (gettimeofday(&now, 0) < 0) {
|
||||||
perror("gettimeofday(now)");
|
err(1, "gettimeofday(now)");
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
if (sent.tv_sec + wtime <= now.tv_sec)
|
if (sent.tv_sec + wtime <= now.tv_sec)
|
||||||
break;
|
break;
|
||||||
@ -501,8 +497,7 @@ out(const char *host)
|
|||||||
struct hostent *hp;
|
struct hostent *hp;
|
||||||
|
|
||||||
if (gettimeofday(&sent, 0) < 0) {
|
if (gettimeofday(&sent, 0) < 0) {
|
||||||
perror("gettimeofday(sent)");
|
err(-1, "gettimeofday(sent)");
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&router, 0, sizeof(router));
|
memset(&router, 0, sizeof(router));
|
||||||
@ -522,8 +517,7 @@ out(const char *host)
|
|||||||
|
|
||||||
if (sendto(soc, &omsg_buf, omsg_len, 0,
|
if (sendto(soc, &omsg_buf, omsg_len, 0,
|
||||||
(struct sockaddr *)&router, sizeof(router)) < 0) {
|
(struct sockaddr *)&router, sizeof(router)) < 0) {
|
||||||
perror(host);
|
err(-1, host);
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user