]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
asterisk.c: Fix sending incorrect messages to systemd notify
authorIvan Poddubny <ivan.poddubny@gmail.com>
Sun, 5 May 2024 12:53:11 +0000 (14:53 +0200)
committerIvan Poddubny <ivan.poddubny@gmail.com>
Mon, 6 May 2024 16:08:47 +0000 (16:08 +0000)
Send "RELOADING=1" instead of "RELOAD=1" to follow the format
expected by systemd (see sd_notify(3) man page).

Do not send STOPPING=1 in remote console mode:
attempting to execute "asterisk -rx" by the main process leads to
a warning if NotifyAccess=main (the default) or to a forced termination
if NotifyAccess=all.

main/asterisk.c
main/loader.c

index 9bcd02bc317cbc136163bc2795973b98be9dc1ab..e0a37ea6cfa969bd4a217c0383417cacb599ce2c 100644 (file)
@@ -2050,7 +2050,7 @@ static void really_quit(int num, shutdown_nice_t niceness, int restart)
                run_cleanups = 0;
        }
 
-       if (!restart) {
+       if (!restart && !ast_opt_remote) {
                ast_sd_notify("STOPPING=1");
        }
        if (ast_opt_console || (ast_opt_remote && !ast_opt_exec)) {
index f2009f94e29a869b25b77e9a9ae2004a3e03dc39..4f5c0bdb3896d0b2b07b44a248098be97c58e0ae 100644 (file)
@@ -1737,7 +1737,7 @@ enum ast_module_reload_result ast_module_reload(const char *name)
                res = AST_MODULE_RELOAD_IN_PROGRESS;
                goto module_reload_exit;
        }
-       ast_sd_notify("RELOAD=1");
+       ast_sd_notify("RELOADING=1");
        ast_lastreloadtime = ast_tvnow();
 
        if (ast_opt_lock_confdir) {