From: Keith Sklower Date: Sat, 23 Jun 1990 06:41:19 +0000 (-0800) Subject: Don't bother to read echoed messages to rtsock; failures will be X-Git-Tag: BSD-4_3_Reno-Snapshot-Development~1877 X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/commitdiff_plain/104e26d60d357b0b06677f67640ad5e480a51d9d Don't bother to read echoed messages to rtsock; failures will be noted via normal errno mechanism, and this is run on the local system anyway for now. SCCS-vsn: sbin/route/route.c 5.27 --- diff --git a/usr/src/sbin/route/route.c b/usr/src/sbin/route/route.c index 2fda3f0e82..a7997e2476 100644 --- a/usr/src/sbin/route/route.c +++ b/usr/src/sbin/route/route.c @@ -12,7 +12,7 @@ char copyright[] = #endif /* not lint */ #ifndef lint -static char sccsid[] = "@(#)route.c 5.26 (Berkeley) %G%"; +static char sccsid[] = "@(#)route.c 5.27 (Berkeley) %G%"; #endif /* not lint */ #include @@ -141,6 +141,7 @@ char *argv[]; } m_u; } m; + shutdown(s, 0); /* Don't want to read back our messages */ if (argc > 1) { argv++; if (argc == 2 && **argv == '-') switch (keyword(1 + *argv)) { @@ -175,16 +176,6 @@ char *argv[]; printf("got only %d for rlen\n", rlen); break; } - again: - if ((rlen = read(s, (char *)&m, sizeof (m))) < 0) { - perror("reading from routing socket"); - printf("got only %d for rlen\n", rlen); - break; - } - if ((m.m_rtm.rtm_pid != pid) || (m.m_rtm.rtm_seq != seqno)) { - printf("Got response for somebody else's request"); - goto again; - } seqno++; if (qflag) continue; @@ -411,6 +402,7 @@ newroute(argc, argv) struct hostent *hp = 0; extern int errno; + shutdown(s, 0); /* Don't want to read back our messages */ cmd = argv[0]; while (--argc > 0) { if (**(++argv)== '-') { @@ -853,24 +845,6 @@ rtmsg(cmd, flags) printf("got only %d for rlen\n", rlen); return (-1); } -again: - if ((rlen = read(s, (char *)&m_rtmsg, l)) < 0) { - perror("reading from routing socket"); - printf("got only %d for rlen\n", rlen); - return (-1); - } - if ((m_rtmsg.m_rtm.rtm_pid != pid) || - (m_rtmsg.m_rtm.rtm_seq != seq)) { - printf("Got response for somebody else's request"); - goto again; - } - if (qflag == 0) - print_rtmsg( &m_rtmsg.m_rtm, rlen); - if ((m_rtmsg.m_rtm.rtm_flags & RTF_DONE) == 0) { - errno = m_rtmsg.m_rtm.rtm_errno; - perror("response from routing socket turned down"); - return (-1); - } return (0); }