[asterisk-bugs] [JIRA] (ASTERISK-25585) [patch]rasterisk never hits most of main(), but it's assumed to
Rusty Newton (JIRA)
noreply at issues.asterisk.org
Mon Nov 23 16:44:33 CST 2015
[ https://issues.asterisk.org/jira/browse/ASTERISK-25585?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Rusty Newton updated ASTERISK-25585:
------------------------------------
Summary: [patch]rasterisk never hits most of main(), but it's assumed to (was: rasterisk never hits most of main(), but it's assumed to)
> [patch]rasterisk never hits most of main(), but it's assumed to
> ---------------------------------------------------------------
>
> Key: ASTERISK-25585
> URL: https://issues.asterisk.org/jira/browse/ASTERISK-25585
> Project: Asterisk
> Issue Type: Bug
> Security Level: None
> Components: Core/General
> Reporter: Walter Doekes
> Severity: Minor
> Target Release: 11.20.0
>
>
> If you look at (Asterisk 11) main/asterisk.c main(), halfway, you see this:
> {code}
> ...
> if (ast_tryconnect()) {
> /* One is already running */
> if (ast_opt_remote) {
> multi_thread_safe = 1;
> if (ast_opt_exec) {
> ast_remotecontrol(xarg);
> quit_handler(0, SHUTDOWN_FAST, 0);
> exit(0);
> }
> print_intro_message(runuser, rungroup);
> printf("%s", term_quit());
> ast_remotecontrol(NULL);
> quit_handler(0, SHUTDOWN_FAST, 0);
> exit(0);
> } else {
> fprintf(stderr, "Asterisk already running on %s. Use 'asterisk -r' to connect.\n", ast_config_AST_SOCKET);
> printf("%s", term_quit());
> exit(1);
> }
> } else if (ast_opt_remote || ast_opt_exec) {
> fprintf(stderr, "Unable to connect to remote asterisk (does %s exist?)\n", ast_config_AST_SOCKET);
> printf("%s", term_quit());
> exit(1);
> }
> ...
> {code}
> If we're an rasterisk call, we either exit 0 or exit 1, but we never pass this bit.
> However, later on, things appear like:
> {code}
> ast_term_init();
> {code}
> And:
> {code}
> } else if (ast_opt_remote && (write(STDOUT_FILENO, "\nUse EXIT or QUIT to exit the asterisk console\n",
> {code}
> That last bit looks like dead code, but the ast_term_init itself looks like it wants to be called for rasterisk instances as well:
> {code}
> if (!ast_opt_console) {
> /* If any remote console is not compatible, we'll strip the color codes at that point */
> vt100compat = 1;
> goto end;
> }
> {code}
> If rasterisk, then !ast_opt_console, is what I'm thinking.
> In any case, this revealed itself when someone was trying to use the colored prompt function in their asterisk {{ASTERISK_PROMPT="%C31*CLI>%C5 " asterisk -r}} -- which is a bad idea, but that's another matter.
> In this case, because ast_term_init was not called, vt100compat is not 1 and the colored prompt would be colorless.
> Thus, two issues:
> * Dead code in main().
> * ast_term_init is not called for rasterisk.
--
This message was sent by Atlassian JIRA
(v6.2#6252)
More information about the asterisk-bugs
mailing list