[asterisk-commits] tilghman: trunk r154922 - /trunk/main/asterisk.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Nov 5 16:19:18 CST 2008


Author: tilghman
Date: Wed Nov  5 16:19:18 2008
New Revision: 154922

URL: http://svn.digium.com/view/asterisk?view=rev&rev=154922
Log:
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.

Modified:
    trunk/main/asterisk.c

Modified: trunk/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/trunk/main/asterisk.c?view=diff&rev=154922&r1=154921&r2=154922
==============================================================================
--- trunk/main/asterisk.c (original)
+++ trunk/main/asterisk.c Wed Nov  5 16:19:18 2008
@@ -1374,7 +1374,7 @@
 		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 @@
 		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 @@
 		}
 		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);
 




More information about the asterisk-commits mailing list