From: Stefan Knoblich Date: Thu, 23 May 2013 00:05:25 +0000 (+0200) Subject: ivrd: fflush() stdout before entering esl_listen() X-Git-Tag: v1.2.13~202 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a573be11a13bc440b492573d84da2fdec28a1d07;p=thirdparty%2Ffreeswitch.git ivrd: fflush() stdout before entering esl_listen() Fixes repeatedly printing the 'Starting forking listener' message, if stdout has been redirected into a logfile (for example). Signed-off-by: Stefan Knoblich --- diff --git a/libs/esl/ivrd.c b/libs/esl/ivrd.c index 6098abcaf9..0d1a98ec4f 100644 --- a/libs/esl/ivrd.c +++ b/libs/esl/ivrd.c @@ -154,13 +154,20 @@ int main(int argc, char *argv[]) return -1; } + /* + * NOTE: fflush() stdout before entering esl_listen(). + * Not doing so causes the fork()ed child to repeat the message for every incoming + * connection, if stdout has been redirected (into a logfile, for example). + */ if (thread) { printf("Starting threaded listener.\n"); + fflush(stdout); esl_listen_threaded(ip, port, mycallback, 100000); } else { printf("Starting forking listener.\n"); + fflush(stdout); esl_listen(ip, port, my_forking_callback); } - + return 0; }