]> git.sur5r.net Git - openldap/commitdiff
ITS#8118 dosearch: flush stdout
authorThomas Cort <linuxgeek@gmail.com>
Wed, 29 Apr 2015 17:33:53 +0000 (13:33 -0400)
committerQuanah Gibson-Mount <quanah@openldap.org>
Thu, 30 Apr 2015 00:03:24 +0000 (19:03 -0500)
The LDIF output wasn't being explicitly flushed. In certain scenarios,
such as piping the output of a persistent ldapsearch to node.js v0.12
on Mac OS X 10.10.3, the output is unavailable to the process
consuming the search results until the stdio buffer fills (8192 bytes
for example). This can leave the tail end of persistent search results
in the buffer for a long time (until enough output has accumulated).

Explicitly call flush so that the output is immediately available.

clients/tools/ldapsearch.c

index c98444f78180c839ce988f43cd5eb3782486fb00..e20eba2b5be2ee895f70d96993fa92ec99846bc4 100644 (file)
@@ -1537,6 +1537,7 @@ static int dosearch(
                }
 
                ldap_msgfree( res );
+               fflush( stdout );
        }
 
 done: