From: Corey Farrell Date: Thu, 15 Nov 2018 11:33:11 +0000 (-0500) Subject: core: Fix handling of restart from remote console. X-Git-Tag: 16.1.0-rc1~29^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a36cd6960caa55d04126e8ad58d21879a81336f0;p=thirdparty%2Fasterisk.git core: Fix handling of restart from remote console. We cannot use need_el_end and SIGURG when restarting. Instead we need to run el_end within the SIGHUP restartnow handler. ASTERISK-28158 Change-Id: Ia852276363c81bdcf1aa29eb4558c5c2fa1218a0 --- diff --git a/main/asterisk.c b/main/asterisk.c index 12e6255db1..cf50b3fcdd 100644 --- a/main/asterisk.c +++ b/main/asterisk.c @@ -1673,9 +1673,15 @@ static struct sigaction urg_handler = { static void _hup_handler(int num) { int save_errno = errno; - printf("Received HUP signal -- Reloading configs\n"); - if (restartnow) + + if (restartnow) { + if (el) { + el_end(el); + } execvp(_argv[0], _argv); + } + + printf("Received HUP signal -- Reloading configs\n"); sig_flags.need_reload = 1; if (ast_alertpipe_write(sig_alert_pipe)) { fprintf(stderr, "hup_handler: write() failed: %s\n", strerror(errno)); @@ -2016,7 +2022,7 @@ static void really_quit(int num, shutdown_nice_t niceness, int restart) if (el_hist != NULL) { history_end(el_hist); } - } else { + } else if (!restart) { sig_flags.need_el_end = 1; pthread_kill(consolethread, SIGURG); }