From owner-freebsd-bugs@FreeBSD.ORG Wed Oct 20 13:40:10 2010 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F513106566B for ; Wed, 20 Oct 2010 13:40:10 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 325518FC16 for ; Wed, 20 Oct 2010 13:40:10 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o9KDeALB046241 for ; Wed, 20 Oct 2010 13:40:10 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o9KDeA4x046240; Wed, 20 Oct 2010 13:40:10 GMT (envelope-from gnats) Resent-Date: Wed, 20 Oct 2010 13:40:10 GMT Resent-Message-Id: <201010201340.o9KDeA4x046240@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Eric van Gyzen Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A941D106566B for ; Wed, 20 Oct 2010 13:35:58 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 97BCE8FC1C for ; Wed, 20 Oct 2010 13:35:58 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o9KDZwa0099168 for ; Wed, 20 Oct 2010 13:35:58 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id o9KDZw53099167; Wed, 20 Oct 2010 13:35:58 GMT (envelope-from nobody) Message-Id: <201010201335.o9KDZw53099167@www.freebsd.org> Date: Wed, 20 Oct 2010 13:35:58 GMT From: Eric van Gyzen To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: bin/151600: [patch] route(8) does not always flush stdout X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Oct 2010 13:40:10 -0000 >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: