Index: main/asterisk.c =================================================================== --- main/asterisk.c (revision 268572) +++ main/asterisk.c (working copy) @@ -1635,8 +1635,6 @@ static void quit_handler(int num, int niceness, in snprintf(filename, sizeof(filename), "%s/.asterisk_history", getenv("HOME")); if (!ast_strlen_zero(filename)) ast_el_write_history(filename); - if (el != NULL) - el_end(el); if (el_hist != NULL) history_end(el_hist); } @@ -1670,6 +1668,10 @@ static void quit_handler(int num, int niceness, in ast_verbose("Asterisk is now restarting...\n"); restartnow = 1; + /* close editline after logging is complete */ + if ((ast_opt_console || (ast_opt_remote && !ast_opt_exec)) && el != NULL) + el_end(el); + /* close logger */ close_logger(); @@ -1683,6 +1685,10 @@ static void quit_handler(int num, int niceness, in execvp(_argv[0], _argv); } else { + /* close editline after logging is complete */ + if ((ast_opt_console || (ast_opt_remote && !ast_opt_exec)) && el != NULL) + el_end(el); + /* close logger */ close_logger(); }