From nobody@FreeBSD.org  Wed Oct 20 13:35:58 2010
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A941D106566B
	for <freebsd-gnats-submit@FreeBSD.org>; 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 <freebsd-gnats-submit@FreeBSD.org>; 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 <freebsd-gnats-submit@FreeBSD.org>; 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 <eric@vangyzen.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [patch] route(8) does not always flush stdout
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         151600
>Category:       bin
>Synopsis:       [patch] route(8) does not always flush stdout
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    glebius
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Oct 20 13:40:09 UTC 2010
>Closed-Date:    Sun Jan 20 07:38:59 UTC 2013
>Last-Modified:  Sun Jan 20 07:40:00 UTC 2013
>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:
State-Changed-From-To: open->patched 
State-Changed-By: glebius 
State-Changed-When: Tue Dec 4 11:10:45 UTC 2012 
State-Changed-Why:  
Committed, thanks! 


Responsible-Changed-From-To: freebsd-bugs->glebius 
Responsible-Changed-By: glebius 
Responsible-Changed-When: Tue Dec 4 11:10:45 UTC 2012 
Responsible-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=151600 
State-Changed-From-To: patched->closed 
State-Changed-By: glebius 
State-Changed-When: Sun Jan 20 07:34:32 UTC 2013 
State-Changed-Why:  
Merged to stable/9. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=151600 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/151600: commit references a PR
Date: Sun, 20 Jan 2013 07:38:51 +0000 (UTC)

 Author: glebius
 Date: Sun Jan 20 07:38:38 2013
 New Revision: 245682
 URL: http://svnweb.freebsd.org/changeset/base/245682
 
 Log:
   Merge r243860 from head:
     Flush stdout after RTM_IFANNOUNCE message.
   
     PR:		bin/151600
     Submitted by:	Eric van Gyzen <eric vangyzen.net>
 
 Modified:
   stable/9/sbin/route/route.c
 Directory Properties:
   stable/9/sbin/route/   (props changed)
 
 Modified: stable/9/sbin/route/route.c
 ==============================================================================
 --- stable/9/sbin/route/route.c	Sun Jan 20 04:04:37 2013	(r245681)
 +++ stable/9/sbin/route/route.c	Sun Jan 20 07:38:38 2013	(r245682)
 @@ -1413,6 +1413,7 @@ print_rtmsg(struct rt_msghdr *rtm, size_
  			break;
  		}
  		printf("\n");
 +		fflush(stdout);
  		break;
  
  	default:
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
>Unformatted:
