From: Russell Bryant Date: Wed, 22 Sep 2010 16:39:16 +0000 (+0000) Subject: Fix a 100% CPU consumption problem when setting console=yes in asterisk.conf. X-Git-Tag: 1.4.38-rc1~59 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bcd4e8787cdb576ba146f94c311c9b67d3bc44fa;p=thirdparty%2Fasterisk.git Fix a 100% CPU consumption problem when setting console=yes in asterisk.conf. The handling of -c and console=yes should be the same, but they were not. When you specify -c, it sets both a flag for console module and for asterisk not to fork() off into the background. The handling of console=yes only set console mode, so you would end up with a background process() trying to run the Asterisk console and freaking out since it didn't have anything to read input from. Thanks to beagles for reporting and helping debug the problem! git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@288339 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/asterisk.c b/main/asterisk.c index b0e4581d1e..a5fd88a054 100644 --- a/main/asterisk.c +++ b/main/asterisk.c @@ -2625,7 +2625,7 @@ static void ast_readconfig(void) ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_QUIET); /* Run as console (-c at startup, implies nofork) */ } else if (!strcasecmp(v->name, "console")) { - ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_CONSOLE); + ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_NO_FORK | AST_OPT_FLAG_CONSOLE); /* Run with high priority if the O/S permits (-p at startup) */ } else if (!strcasecmp(v->name, "highpriority")) { ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_HIGH_PRIORITY);