[Asterisk-code-review] core: Fix handling of restart from remote console. (asterisk[master])

George Joseph asteriskteam at digium.com
Fri Nov 16 09:22:27 CST 2018


George Joseph has submitted this change and it was merged. ( https://gerrit.asterisk.org/10648 )

Change subject: core: Fix handling of restart from remote console.
......................................................................

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
---
M main/asterisk.c
1 file changed, 9 insertions(+), 3 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved; Approved for Submit



diff --git a/main/asterisk.c b/main/asterisk.c
index a751c3b..7eb49df 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -1676,9 +1676,15 @@
 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));
@@ -2019,7 +2025,7 @@
 			if (el_hist != NULL) {
 				history_end(el_hist);
 			}
-		} else {
+		} else if (!restart) {
 			sig_flags.need_el_end = 1;
 			pthread_kill(consolethread, SIGURG);
 		}

-- 
To view, visit https://gerrit.asterisk.org/10648
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia852276363c81bdcf1aa29eb4558c5c2fa1218a0
Gerrit-Change-Number: 10648
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2 (1000185)
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20181116/6ae0f6a5/attachment.html>


More information about the asterisk-code-review mailing list