Module: kamailio
Branch: master
Commit: ed5899b8213a28eb5659edfd5b1b9740ba6a5ab5
URL:
https://github.com/kamailio/kamailio/commit/ed5899b8213a28eb5659edfd5b1b974…
Author: Anton Yabchinskiy <arn(a)bestmx.net>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2024-11-19T16:04:13+01:00
modules/snmpstats: exit with ksr_exit() instead of standard exit()
The former respects the `--atexit=no` from Kamailio command line.
See note on `atexit` in TLS module "Overview".
---
Modified: src/modules/snmpstats/snmpstats.c
Modified: src/modules/snmpstats/sub_agent.c
---
Diff:
https://github.com/kamailio/kamailio/commit/ed5899b8213a28eb5659edfd5b1b974…
Patch:
https://github.com/kamailio/kamailio/commit/ed5899b8213a28eb5659edfd5b1b974…
---
diff --git a/src/modules/snmpstats/snmpstats.c b/src/modules/snmpstats/snmpstats.c
index 34b699bdeb2..ac0614f777e 100644
--- a/src/modules/snmpstats/snmpstats.c
+++ b/src/modules/snmpstats/snmpstats.c
@@ -92,6 +92,7 @@
#include "../../core/script_cb.h"
#include "../../core/mem/mem.h"
#include "../../core/mem/shm_mem.h"
+#include "../../core/daemonize.h"
#include "snmpSIPRegUserTable.h"
#include "snmpSIPContactTable.h"
@@ -561,14 +562,14 @@ static int spawn_sysUpTime_child(void)
"kamailioSIPServiceStartTime is defaulting to zero\n");
close(snmpget_fd);
free(full_path_to_snmpget);
- exit(-1);
+ ksr_exit(-1);
}
/* We should never be able to get here, because execve() is never
* supposed to return. */
close(snmpget_fd);
free(full_path_to_snmpget);
- exit(-1);
+ ksr_exit(-1);
}
diff --git a/src/modules/snmpstats/sub_agent.c b/src/modules/snmpstats/sub_agent.c
index 92ca838c944..cc3ff06aa02 100644
--- a/src/modules/snmpstats/sub_agent.c
+++ b/src/modules/snmpstats/sub_agent.c
@@ -65,6 +65,7 @@
#include "../../core/dprint.h"
#include "../../core/cfg/cfg_struct.h"
+#include "../../core/daemonize.h"
static int keep_running;
@@ -72,7 +73,7 @@ static int keep_running;
static void sigterm_handler(int signal)
{
/* Just exit. The master agent will clean everything up for us */
- exit(0);
+ ksr_exit(0);
}
/*! This function:
@@ -125,7 +126,7 @@ static int initialize_agentx(void)
LM_DBG("Shutting down Kamailio SNMPD MasterX sub agent.\n");
snmp_shutdown(AGENT_PROCESS_NAME);
SOCK_CLEANUP;
- exit(0);
+ ksr_exit(0);
return 0;
}