aboutsummaryrefslogtreecommitdiffstats
path: root/main/asterisk.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-11-05 22:19:18 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-11-05 22:19:18 +0000
commit921b015a769d55268b4aa95c0bea42dfaa07397e (patch)
treeb34bc1bafd37edb3e6a761bad63fdbab56a32dc0 /main/asterisk.c
parent8b5c11ae52a7ba97fb413eaab466267d061874c6 (diff)
Don't read history on -rx commands.
(Closes issue #13571) Reported by: tzafrir Patch '0001-no-need-for-history-on-asterisk-rx.patch' uploaded by tzafrir. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@154922 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/asterisk.c')
-rw-r--r--main/asterisk.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/main/asterisk.c b/main/asterisk.c
index 37c84bd67..22454349d 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -1374,7 +1374,7 @@ static void quit_handler(int num, int niceness, int safeshutdown, int restart)
if (niceness)
ast_module_shutdown();
}
- if (ast_opt_console || ast_opt_remote) {
+ if (ast_opt_console || (ast_opt_remote && !ast_opt_exec)) {
if (getenv("HOME"))
snprintf(filename, sizeof(filename), "%s/.asterisk_history", getenv("HOME"));
if (!ast_strlen_zero(filename))
@@ -2474,17 +2474,6 @@ static void ast_remotecontrol(char *data)
else
printf("log and verbose output currently muted ('logger mute' to unmute)\n");
}
- ast_verbose("Connected to Asterisk %s currently running on %s (pid = %d)\n", version, hostname, pid);
- remotehostname = hostname;
- if (getenv("HOME"))
- snprintf(filename, sizeof(filename), "%s/.asterisk_history", getenv("HOME"));
- if (el_hist == NULL || el == NULL)
- ast_el_initialize();
-
- el_set(el, EL_GETCFN, ast_el_read_char);
-
- if (!ast_strlen_zero(filename))
- ast_el_read_history(filename);
if (ast_opt_exec && data) { /* hack to print output then exit if asterisk -rx is used */
struct pollfd fds;
@@ -2523,6 +2512,19 @@ static void ast_remotecontrol(char *data)
}
return;
}
+
+ ast_verbose("Connected to Asterisk %s currently running on %s (pid = %d)\n", version, hostname, pid);
+ remotehostname = hostname;
+ if (getenv("HOME"))
+ snprintf(filename, sizeof(filename), "%s/.asterisk_history", getenv("HOME"));
+ if (el_hist == NULL || el == NULL)
+ ast_el_initialize();
+
+ el_set(el, EL_GETCFN, ast_el_read_char);
+
+ if (!ast_strlen_zero(filename))
+ ast_el_read_history(filename);
+
for (;;) {
ebuf = (char *)el_gets(el, &num);