On Mon, Nov 24, 2014 at 04:44:44PM -0700, Todd C. Miller wrote:
> On Tue, 25 Nov 2014 00:53:10 +0200, Kaspars Bankovskis wrote:
> 
> > Something like this?
> 
> Please don't use setlinebuf() as it is not portable.  Try:
> 
>     setvbuf(ttyout, NULL, _IOLBF, 0);
> 
> instead.
> 
>  - todd
> 

OK, I see. Thanks for explaining.


Index: fetch.c
===================================================================
RCS file: /cvs/src/usr.bin/ftp/fetch.c,v
retrieving revision 1.134
diff -u -p -r1.134 fetch.c
--- fetch.c     31 Oct 2014 13:48:21 -0000      1.134
+++ fetch.c     25 Nov 2014 07:59:50 -0000
@@ -515,6 +515,10 @@ noslash:
        }
 #endif /* !SMALL */
 
+       /* ensure consistent order of the output */
+       if (verbose)
+               setvbuf(ttyout, NULL, _IOLBF, 0);
+
        s = -1;
        for (res = res0; res; res = res->ai_next) {
                if (getnameinfo(res->ai_addr, res->ai_addrlen, hbuf,

Reply via email to