]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
ivrd: fflush() stdout before entering esl_listen()
authorStefan Knoblich <stkn@openisdn.net>
Thu, 23 May 2013 00:05:25 +0000 (02:05 +0200)
committerTravis Cross <tc@traviscross.com>
Fri, 7 Jun 2013 05:42:45 +0000 (05:42 +0000)
Fixes repeatedly printing the 'Starting forking listener' message,
if stdout has been redirected into a logfile (for example).

Signed-off-by: Stefan Knoblich <stkn@openisdn.net>
libs/esl/ivrd.c

index 6098abcaf9687540b4b1ce62bdc2955c1d0de4d5..0d1a98ec4f4fcea0129671a877692846100ccf69 100644 (file)
@@ -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;
 }