Date: Wed, 20 Oct 2010 13:35:58 GMT From: Eric van Gyzen <eric@vangyzen.net> To: freebsd-gnats-submit@FreeBSD.org Subject: bin/151600: [patch] route(8) does not always flush stdout Message-ID: <201010201335.o9KDZw53099167@www.freebsd.org> Resent-Message-ID: <201010201340.o9KDeA4x046240@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 151600
>Category: bin
>Synopsis: [patch] route(8) does not always flush stdout
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Oct 20 13:40:09 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator: Eric van Gyzen
>Release: 8.1-RELEASE
>Organization:
McAfee, Inc.
>Environment:
N/A
>Description:
The route(8) command does not flush stdout after printing a RTM_IFANNOUNCE message or a RTM_IFINFO message that has no addresses. These flushes are critical for, say, writing a script that parses the output of "/sbin/route -n monitor" to act on changes in link status in a timely fashion.
>How-To-Repeat:
1. Run:
/sbin/route -n monitor | cat
2. Plug/unplug some network cables.
3. Notice that the link status messages are not displayed.
4. In another terminal, run:
/sbin/route -n get default
5. Notice that the link status messages are displayed immediately before the other messages.
>Fix:
diff -u -r1.93 route.c
--- route.c 27 Feb 2010 10:18:33 -0000 1.93
+++ route.c 20 Oct 2010 13:26:14 -0000
@@ -1395,6 +1395,7 @@
break;
}
printf("\n");
+ (void) fflush(stdout);
break;
default:
@@ -1517,6 +1518,7 @@
if (addrs == 0) {
(void) putchar('\n');
+ (void) fflush(stdout);
return;
}
(void) printf("\nsockaddrs: ");
>Release-Note:
>Audit-Trail:
>Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010201335.o9KDZw53099167>
