[sr-dev] git:master:4f6243e8: core: more use of ksr_exit() macro to follow --atexit param

Daniel-Constantin Mierla miconda at gmail.com
Tue Feb 9 10:50:50 CET 2021


Module: kamailio
Branch: master
Commit: 4f6243e8e6e2012af35aae67da7b93af2127f02c
URL: https://github.com/kamailio/kamailio/commit/4f6243e8e6e2012af35aae67da7b93af2127f02c

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2021-02-09T10:50:03+01:00

core: more use of ksr_exit() macro to follow --atexit param

---

Modified: src/core/cfg.lex
Modified: src/core/cfg.y
Modified: src/core/sr_module.c
Modified: src/core/tcp_read.c

---

Diff:  https://github.com/kamailio/kamailio/commit/4f6243e8e6e2012af35aae67da7b93af2127f02c.diff
Patch: https://github.com/kamailio/kamailio/commit/4f6243e8e6e2012af35aae67da7b93af2127f02c.patch

---

diff --git a/src/core/cfg.lex b/src/core/cfg.lex
index 08037102cb..90d6f685a7 100644
--- a/src/core/cfg.lex
+++ b/src/core/cfg.lex
@@ -39,6 +39,7 @@
 	#include "select.h"
 	#include "cfg.tab.h"
 	#include "sr_compat.h"
+	#include "daemonize.h"
 	#include "ppcfg.h"
 
 	/* states */
@@ -1308,7 +1309,7 @@ IMPORTFILE      "import_file"
 									LM_CRIT(
 										"error at %s line %d: '-' not allowed\n",
 										(finame)?finame:"cfg", line);
-									exit(-1);
+									ksr_exit(-1);
 								}
 <DEFINE_ID>{ID}                 {	count();
 									ksr_cfg_print_part(yytext);
@@ -1350,7 +1351,7 @@ IMPORTFILE      "import_file"
 									LM_CRIT(
 										"error at %s line %d: '-' not allowed\n",
 										(finame)?finame:"cfg", line);
-									exit(-1);
+									ksr_exit(-1);
 								}
 <IFDEF_ID>{ID}                { count();
 								pp_ifdef_var(yyleng, yytext);
@@ -1404,7 +1405,7 @@ IMPORTFILE      "import_file"
 				if(sr_push_yy_state(s_buf.s, 0)<0)
 				{
 					LOG(L_CRIT, "error at %s line %d\n", (finame)?finame:"cfg", line);
-					exit(-1);
+					ksr_exit(-1);
 				}
 				memset(&s_buf, 0, sizeof(s_buf));
 				ksr_cfg_print_initial_state();
@@ -1418,7 +1419,7 @@ IMPORTFILE      "import_file"
 				if(sr_push_yy_state(s_buf.s, 1)<0)
 				{
 					LM_CRIT("error at %s line %d\n", (finame)?finame:"cfg", line);
-					exit(-1);
+					ksr_exit(-1);
 				}
 				memset(&s_buf, 0, sizeof(s_buf));
 				ksr_cfg_print_initial_state();
@@ -1439,7 +1440,7 @@ IMPORTFILE      "import_file"
 				ksr_cfg_print_part(yytext);
 				if(pp_define_env(yytext, yyleng) < 0) {
 					LM_CRIT("error at %s line %d\n", (finame)?finame:"cfg", line);
-					exit(-1);
+					ksr_exit(-1);
 				}
 				state = INITIAL;
 				ksr_cfg_print_initial_state();
@@ -1610,7 +1611,7 @@ static char* addstr(struct str_buf* dst_b, char* src, int len)
 	return dst_b->s;
 error:
 	PKG_MEM_CRITICAL;
-	exit(-1);
+	ksr_exit(-1);
 }
 
 
diff --git a/src/core/cfg.y b/src/core/cfg.y
index 7d59805555..0d991ee98b 100644
--- a/src/core/cfg.y
+++ b/src/core/cfg.y
@@ -69,6 +69,7 @@
 #include "ppcfg.h"
 #include "pvapi.h"
 #include "config.h"
+#include "daemonize.h"
 #include "cfg_core.h"
 #include "cfg/cfg.h"
 #ifdef CORE_TLS
@@ -3521,7 +3522,7 @@ cmd:
 		if (mod_func_action != NULL) {
 			LM_ERR("function used inside params of another function: %s\n", $1);
 			yyerror("use of function execution inside params not allowed\n");
-			exit(-1);
+			ksr_exit(-1);
 		}
 		mod_func_action = mk_action(MODULE0_T, 2, MODEXP_ST, NULL, NUMBER_ST, 0);
 		} LPAREN func_params RPAREN	{
diff --git a/src/core/sr_module.c b/src/core/sr_module.c
index 58624ea06e..3af6b310dd 100644
--- a/src/core/sr_module.c
+++ b/src/core/sr_module.c
@@ -45,6 +45,7 @@
 #include "fmsg.h"
 #include "async_task.h"
 #include "shm_init.h"
+#include "daemonize.h"
 
 #include <sys/stat.h>
 #include <regex.h>
@@ -541,7 +542,7 @@ int load_module(char* mod_path)
 	}
 	/* version control */
 	if (!version_control(handle, path)) {
-		exit(-1);
+		ksr_exit(-1);
 	}
 	/* launch register */
 	mr = (mod_register_function)dlsym(handle, "mod_register");
diff --git a/src/core/tcp_read.c b/src/core/tcp_read.c
index 50853cc5b6..48a683d32f 100644
--- a/src/core/tcp_read.c
+++ b/src/core/tcp_read.c
@@ -52,6 +52,7 @@
 #include "ut.h"
 #include "trim.h"
 #include "pt.h"
+#include "daemonize.h"
 #include "cfg/cfg_struct.h"
 #ifdef CORE_TLS
 #include "tls/tls_server.h"
@@ -2009,7 +2010,7 @@ void tcp_receive_loop(int unix_sock)
 error:
 	destroy_io_wait(&io_w);
 	LM_CRIT("exiting...");
-	exit(-1);
+	ksr_exit(-1);
 }
 
 




More information about the sr-dev mailing list